Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Excel Runmacro
#4
Macro Macro1416
Code:
Copy      Help
;/exe 1
ExcelSheet es.Init
Excel.Workbook wb=es.ws.Application.ActiveWorkbook

;use IDispatch because I don't know in which type library is VBProject
IDispatch objWorkbook=wb
IDispatch xlmodule = objWorkbook.VBProject.VBComponents.Add(1)
err mes- "Failed. You probably need to change Excel security settings.[][]Click menu Tools -> Macro -> Security.[]In Publishers tab check 'Trust access to Visual Basic project'." "" "x"

str strCode =
;sub test()
;;msgbox "Inside the macro"
;end sub
;
xlmodule.CodeModule.AddFromString(strCode)

test
Macro Macro1418
Code:
Copy      Help
;/exe 1
act "Excel"
ExcelSheet es.Init
es.RunMacro("test")


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)