How to Add Macro to Workbook using Excel VBA
Here is a simple procedure to add a macro to the current workbook using VBComponents
Sub Add_Macro_To_ThisWorkbook()
Dim VBP As VBProject
Dim VBM As VBComponent
Dim VBModule As CodeModule
Dim VBProc As VBComponent
Set VBP = ThisWorkbook.VBProject
Set VBModule = VBP.VBComponents.Item("ThisWorkbook").CodeModule
VBModule.AddFromString ("Sub Sample_Macro" & vbCrLf & "ret = msgbox (""Hello VBADUD"") " & vbCrLf & "End Sub")
End Sub
Tuesday, September 30, 2008
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.
vba has its own world and it has its own importance there,can never be ignored
ReplyDelete