Hi,
I'm trying to create statements for a macro in Excel. However am getting several errors. This code works fine:
' Add a macro to the module...
Dim strCode As String
strCode = _
"sub MyMacro()" & vbCr & _
" msgbox ""Generated macro"" " & vbCr & _
"end sub"
xlmodule.CodeModule.AddFromString strCode
When I try to change lines I get errors. This is the code:
"sub MyMacro()"
" Workbooks.Open Filename:="C:\Apps\emptyprops.xls"
" Rows("1:1").Select_"
" Selection.Insert Shift:=xlDown_"
" end sub"
xlmodule.CodeModule.AddFromString strCode
thanks in advance
I'm trying to create statements for a macro in Excel. However am getting several errors. This code works fine:
' Add a macro to the module...
Dim strCode As String
strCode = _
"sub MyMacro()" & vbCr & _
" msgbox ""Generated macro"" " & vbCr & _
"end sub"
xlmodule.CodeModule.AddFromString strCode
When I try to change lines I get errors. This is the code:
"sub MyMacro()"
" Workbooks.Open Filename:="C:\Apps\emptyprops.xls"
" Rows("1:1").Select_"
" Selection.Insert Shift:=xlDown_"
" end sub"
xlmodule.CodeModule.AddFromString strCode
thanks in advance