launching excel from access doesnt load addins

D

Daniel M

I have access launching excel and then i want it to run a macro. i have the
macro saved as an add-in and if i load the file normally it opens up and
loads the addin (a menu bar and some macros). but when i load it from access
the addin does not load and i cannot find the macros. how do i get it to
load? I am running the following code...



Dim A As Object
Set A = CreateObject("excel.application")
With A.Application
A.Visible = True
A.workbooks.Open "C:\Documents and Settings\user\Desktop\work\File
Imports\test2.xls"
A.Run testmacro4
A.workbooks.Close
End With
End Sub
 
S

Stuart McCall

Daniel M said:
I have access launching excel and then i want it to run a macro. i have the
macro saved as an add-in and if i load the file normally it opens up and
loads the addin (a menu bar and some macros). but when i load it from
access
the addin does not load and i cannot find the macros. how do i get it to
load? I am running the following code...



Dim A As Object
Set A = CreateObject("excel.application")
With A.Application
A.Visible = True
A.workbooks.Open "C:\Documents and Settings\user\Desktop\work\File
Imports\test2.xls"
A.Run testmacro4
A.workbooks.Close
End With
End Sub

I think its just a syntax problem. Try this:

Dim A As Object
Set A = CreateObject("excel.application")
With A.Application
.Visible = True
.workbooks.Open "C:\Documents and Settings\user\Desktop\work\File
Imports\test2.xls"
.Run testmacro4
.workbooks.Close
End With
 
D

Daniel M

Nope, my addins are in excel not access. if i open any excel file my menus
and macros are there as they should be. i have saved the excel file as an add
in and enabled it in the add-in manager.

The only problem is when access load an excel file the addin's in excel
dont load.
 
S

Stuart McCall

Daniel M said:
Nope, my addins are in excel not access. if i open any excel file my menus
and macros are there as they should be. i have saved the excel file as an
add
in and enabled it in the add-in manager.

The only problem is when access load an excel file the addin's in excel
dont load.

I don't have all that much experience with Excel, so this will have to be a
guess. Maybe Excel is behaving 'as designed' by only loading addins when
Excel is under user control (not automated from another app). Try opening
Excel using FollowHyperlink instead of automation:

Application.FollowHyperlink <PathToExcelFile>, NewWindow:=True
 
E

egun

If you saved it as an addin, should it not have the ".xla" suffix, and
wouldn't it be in the Addins folder?

C:\Documents and Settings\USERNAME\Application Data\Microsoft\AddIns

Also, make sure you have installed that addin (Tools/Addins in Excel - if
your addin does not show, it's not installed. If it does show, check the box
to make it visible to Excel)

Finally, you might try something like this in Access:

A.AddIns("test2.xls").Installed = True
A.AddIns("test2.xls").Visible = True

Eric
 
D

Daniel M

yes the extension is .xla and yes it is installed correctly. when i open the
file by double clicking on it it loads the addin just fine. just not when
launched from access.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top