![]() |
Calling excel macro from VB 6 app problem
I am posting this question for a co-worker but know enough of the problem to
be able to reply. Thanks for any help on this matter. We have an Excel plugin (MyPlugin.xla) in the XLStart folder. We need to run a public subroutine called MySub that is stored in the MyModule module from a VB6 program. We tried the following: Xapp.Application.Run "'MyPlugin.xla'!MyModule.MySub" This results in the following error message: Runtime error '1004': The macro 'MyPlugin.xla!MyModule.MySub' cannot be found. We've tried several combinations of syntax above with the following statements with similar results: Excel.AddIns.Add FileName:="C:\Program Files\Microsoft Office\OFFICE11\XLStart\MyPlugin.xla" AddIns("MyPlugin.xla").Installed = True and Xapp.Workbooks.Open FileName:="C:\Program Files\Microsoft Office\OFFICE11\XLStart\MyPlugin.xla" What is the correct way to run this macro? Thanks, David |
Calling excel macro from VB 6 app problem
You are correct, the addin has to be loaded (and it isn't by default if
Excel is opened through automation). Then you would use the Run command you show. -- Regards, Tom Ogilvy "C. Johnson" wrote in message ... I am posting this question for a co-worker but know enough of the problem to be able to reply. Thanks for any help on this matter. We have an Excel plugin (MyPlugin.xla) in the XLStart folder. We need to run a public subroutine called MySub that is stored in the MyModule module from a VB6 program. We tried the following: Xapp.Application.Run "'MyPlugin.xla'!MyModule.MySub" This results in the following error message: Runtime error '1004': The macro 'MyPlugin.xla!MyModule.MySub' cannot be found. We've tried several combinations of syntax above with the following statements with similar results: Excel.AddIns.Add FileName:="C:\Program Files\Microsoft Office\OFFICE11\XLStart\MyPlugin.xla" AddIns("MyPlugin.xla").Installed = True and Xapp.Workbooks.Open FileName:="C:\Program Files\Microsoft Office\OFFICE11\XLStart\MyPlugin.xla" What is the correct way to run this macro? Thanks, David |
All times are GMT +1. The time now is 01:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com