Re: My .xla custom menu items doesn't show up when using 3rd party software
- From: "Peter T" <peter_t@discussions>
- Date: Thu, 12 Oct 2006 21:33:20 +0100
Hi Michael,
Er, looks like I posted a follow-up about creating menus intended for a
totally different thread after my comments about automated instances of
Excel & RunAutoMacros. I take it you are responding to that and not the
accidentally posted menu stuff. Either way glad one or other of those posts
has worked for you!
Guess I'd better re-post the menu stuff where it belongs (subject: Add-In
Keyboard Shortcut).
Regards,
Peter T
"Michael Malinsky" <mmalinsky@xxxxxxxxx> wrote in message
news:1160682961.791404.119720@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks, Peter. After monkeying around with it in my existing add-inoptionally
with no success, I copied your code exactly as posted into a new xla
and got it to work. Now I just need to modify the code to make a new
menu item and populate it with menu items and cut and paste some code
from my original add-in.
Thanks for the help!
Peter T wrote:
From Auto_Open should add a MyMacro button to the Tools menu and
thedelete any old MyMacro that wasn't deleted in a previous Auto_Close (if
indeed you want to delete menu on close). It also adds a version id to
samebutton's tag property.
Sub Auto_Open()
MyMenu True, 123
End Sub
Sub Auto_Close()
MyMenu False
End Sub
Sub MyMenu(bCreate As Boolean, Optional ver)
Dim cbcTools As CommandBarControl
Dim cbcNew As CommandBarControl
On Error Resume Next
'set a ref to Tools
Set cbcTools = _
Application.CommandBars("Work*** Menu Bar").FindControl(Id:=30007)
'delete any/all MyMacro buttons
Do
cbcTools.Controls("MyMacro").Delete
Loop Until Err.Number
On Error GoTo 0
If bCreate Then
' you might not want temporary:=True
Set cbcNew = cbcTools.Controls.Add(Type:=1, temporary:=True)
cbcNew.Caption = "&MyMacro"
cbcNew.OnAction = "MyMacro"
cbcNew.Tag = "MyVer" & ver
End If
End Sub
Sub MyMacro()
MsgBox "MyMacro"
End Sub
Following to find & delete any menus with tag MyVer123 and replace with
don't(only for testing of course)
Sub CheckMenu()
Dim bFoundCtrl As Boolean
Dim sTag As String
Dim cbc As CommandBarControl
sTag = "MyVer" & 123
On Error Resume Next
Do
Set cbc = Application.CommandBars.FindControl(Tag:=sTag)
If Not cbc Is Nothing Then bFoundCtrl = True
cbc.Delete
Loop Until Err.Number
If bFoundCtrl Then
MsgBox sTag & " found, will now re-create"
MyMenu True, 123
Else
MsgBox sTag & " not found, will now create new"
MyMenu True, True, 123
End If
End Sub
Regards,
Peter T
"Peter T" <peter_t@discussions> wrote in message
news:ekVZJid7GHA.2248@xxxxxxxxxxxxxxxxxxxxxxx
When you create a new automated instance of Excel installed Addins
instanceload, also if you add (ie load) any workbooks to the automated
runningtheir 'auto macros' don't automatically run.routine
Both posted routines have in common
- create a new Excel instance
- load one or more addins and use RunAutoMacros to run the Auto_Open
early
The routines differ in the way the new instance was created, mine used
binding in as much as it was designed for testing in an already
instance.instance of Excel, with a module level reference attached to the
'the
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
otherway 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
failinstalled addins). Providing you managed to start the new instance and
supply the correct path to your addin I don't know why that should
same(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
isline 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
..Fullnameinstalled, either force through under
On Error Resume Next
or check the addin's extentension is "xla" and verify .Name <>
ifintend
For your purposes start your instance however and from where ever you
to, then decide if you want to open only your own addin or all addins,
howthe latter handle possible errors as described above.
Regards,
Peter T
"Michael Malinsky" <mmalinsky@xxxxxxxxx> wrote in message
news:1160596048.456821.192110@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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
class."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
with
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" <rondebr...@xxxxxxxxxxxx> wrote:
If you create the code you can use this for example to open Excel
wrote:add-ins
messagenews:1160518928.741819.308310@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxfrom 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" <mmalin...@xxxxxxxxx> wrote in
@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" <rondebr...@xxxxxxxxxxxx>
runhi Michael
If you run Excel from another program code in Add-ins will not
see it(you see the add-ins checked in Tools>Add-ins)
Run this in Start > Run in Windows with Excel closed and you
menumessagenews:1160511426.655329.88050@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
excel.exe /s
--
Regards Ron de Bruinhttp://www.rondebruin.nl
"Michael Malinsky" <mmalin...@xxxxxxxxx> wrote in
Long subject line...sorry.
Anyway, I have created an .xla add-in that creates a custom
Excel.item
on the standard menu bar. This works fine when opening
add-in,Excel
However, we use a 3rd party application that integrates with
add-inproblems.(essentially document management software) that is causing
supposedIf I open a workbook through that software, the menu that is
to be created with my add-in does not appear even though the
is
checked in the Tools>Add-ins dialog. If a uncheck and
thenclose
the Add-in dialog, open the Add-in dialog, check my add-in,
office,close
the Add-in dialog, the menu appears like it should.
I would like to distribute this add-in to everyone at my
but
solution.this is a sticking point for which I cannot seem to find a
Thanks,
Mike.
.
- References:
- My .xla custom menu items doesn't show up when using 3rd party software
- From: Michael Malinsky
- Re: My .xla custom menu items doesn't show up when using 3rd party software
- From: Ron de Bruin
- Re: My .xla custom menu items doesn't show up when using 3rd party software
- From: Michael Malinsky
- Re: My .xla custom menu items doesn't show up when using 3rd party software
- From: Ron de Bruin
- Re: My .xla custom menu items doesn't show up when using 3rd party software
- From: Michael Malinsky
- Re: My .xla custom menu items doesn't show up when using 3rd party software
- From: Peter T
- Re: My .xla custom menu items doesn't show up when using 3rd party software
- From: Peter T
- Re: My .xla custom menu items doesn't show up when using 3rd party software
- From: Michael Malinsky
- My .xla custom menu items doesn't show up when using 3rd party software
- Prev by Date: Return to excel from vbe
- Next by Date: Re: Add-In Keyboard Shortcut
- Previous by thread: Re: My .xla custom menu items doesn't show up when using 3rd party software
- Next by thread: Pass cell contents to MSTSC.EXE (Remote Desktop)
- Index(es):