View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default My .xla custom menu items doesn't show up when using 3rd party software

When you create a new automated instance of Excel installed Addins don't
load, also if you add (ie load) any workbooks to the automated instance
their 'auto macros' don't automatically run.

Both posted routines have in common
- create a new Excel instance
- load one or more addins and use RunAutoMacros to run the Auto_Open routine

The routines differ in the way the new instance was created, mine used early
binding in as much as it was designed for testing in an already running
instance of Excel, with a module level reference attached to the instance.

Dim xlApp As Application
though would be clearer to have declared as Excel.Application
Normally the instance should be closed using the testClose routine in
particular to destroy the object ref 'xlApp'. You say Excel locked up 'the
way you used it' but you didn't say how.

Ron's / KeepitCool's would be late binding if used outside Excel.

My routine only attempted to open only your own addin (none of any other
installed addins). Providing you managed to start the new instance and
supply the correct path to your addin I don't know why that should fail
(other than errant code in the auto open routine of your addin).

Ron's / KeepitCool's attempts to open all installed addins and on the same
line run their auto open's. Possible reasons for the error you got
- an installed addin is an Excel bundled xll, eg Analys32.xll
- sometimes the bundled xla's don't return the full path with fullname

If you want to load all installed addins, and assuming your own addin is
installed, either force through under
On Error Resume Next
or check the addin's extentension is "xla" and verify .Name < .Fullname

For your purposes start your instance however and from where ever you intend
to, then decide if you want to open only your own addin or all addins, if
the latter handle possible errors as described above.

Regards,
Peter T

"Michael Malinsky" wrote in message
oups.com...
Well I couldn't get either of the above two ideas to work. Maybe I
don't understand placement of the code. Peter T.'s code, at least how
I used it, caused Excel to lock up.

Ron, your code generated an error at the line:

xl.Workbooks.Open(ai.FullName).RunAutoMacros 1

The error was "Unable to get the Open Property of the Workbooks class."

Maybe this has to do with where I put the code, which was in the
Auto_Open of the add-in.

What am I missing?

Thanks.

On Oct 11, 12:42 pm, "Ron de Bruin" wrote:
If you create the code you can use this for example to open Excel with

add-ins
from another program.

But you use a 3rd party application.

This was suggested by KeepItCool and should work:

Code from KeepItCool (Oct 21, 2004)

Sub LoadXLwithAddins()
Dim xl As Object
Dim ai As Object

Set xl = CreateObject("Excel.Application")

For Each ai In Application.AddIns
If ai.Installed Then
xl.Workbooks.Open(ai.FullName).RunAutoMacros 1
End If
Next

xl.Visible = True
Set xl = Nothing
End Sub

--
Regards Ron de Bruinhttp://www.rondebruin.nl

"Michael Malinsky" wrote in

oglegroups.com...
@smw226: I'll give that a try...thanks.


@Ron: Any workaround suggestions other than what was already
suggested?


Thanks.


On Oct 10, 4:45 pm, "Ron de Bruin" wrote:
hi Michael


If you run Excel from another program code in Add-ins will not run
(you see the add-ins checked in ToolsAdd-ins)


Run this in Start Run in Windows with Excel closed and you see it


excel.exe /s


--
Regards Ron de Bruinhttp://www.rondebruin.nl


"Michael Malinsky" wrote in

oglegroups.com...
Long subject line...sorry.


Anyway, I have created an .xla add-in that creates a custom menu

item
on the standard menu bar. This works fine when opening Excel.


However, we use a 3rd party application that integrates with Excel
(essentially document management software) that is causing

problems.
If I open a workbook through that software, the menu that is

supposed
to be created with my add-in does not appear even though the add-in

is
checked in the ToolsAdd-ins dialog. If a uncheck and add-in,

close
the Add-in dialog, open the Add-in dialog, check my add-in, then

close
the Add-in dialog, the menu appears like it should.


I would like to distribute this add-in to everyone at my office,

but
this is a sticking point for which I cannot seem to find a

solution.

Thanks,
Mike.