View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
C. Johnson C. Johnson is offline
external usenet poster
 
Posts: 3
Default 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