View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default How to call a macro from a xlam in a xlsm

There shouldn't be any difference between 2003/2007 with what you are trying
to do. Looks like you are fully qualifying the path to the macro so all the
more reason why it should work. Unless of course any of workbook, project
(sure it's VBAPoroject!), module or macro names are not quite right.

Try simply
'XLAFile.xlam!MacroName'

If that fails rename the macro and try again. If/when working fully qualify
again.

Oh, and ensure of course that the xlam is really open, you should see it in
project explorer. One more thing, depending on the name of the xlam you
might need to embrace it with apostrophes.

Regards,
Peter T


"CLDommel" wrote in message
...
I am writing an aplpication in VBA in Excel 2007. When i used to call a
macro
under excel 2003 I could use: Application.run
"XlaFile.xla!'VBAProject.ModuleName.MacroName"

However when i try to use this construction under Excel 2007 i get the
following error message:

"Cannot run the macro 'XLAFile.xlam!VBAProject.ModuleName.MacroName'. The
macro may not be available in this workbook or all macros may be
disabled."

The Macro is standing in the Workbook_Open event of my xlsm file and is
calling an addin with xlam extension.
The xlam file is selected in the add-in list.

Does anybody have an idea how i can solve the problem? Can i continue
using
the Excel2003 way under Excel2007 or is the call of an macro out of an
add-in
changed under Excel2007