Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with calling .dll from excel VBA atellidou Excel Programming 0 July 5th 05 07:56 AM
calling excel macro TommyBoy Excel Programming 0 August 12th 04 10:25 PM
Calling Excel Macro From Vc++ via DDE hari Excel Programming 0 July 6th 04 12:50 PM
calling a dll from excel macro Stefan[_4_] Excel Programming 1 December 12th 03 12:16 AM
problem with selection when calling macro externally from VB6 [email protected] Excel Programming 1 November 4th 03 08:17 PM


All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"