ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use event to catch the running of a macro from an add-in (https://www.excelbanter.com/excel-programming/410541-use-event-catch-running-macro-add.html)

[email protected]

Use event to catch the running of a macro from an add-in
 
Is there a way to determine when a macro from a 3rd-party add-in has
started running and when it has finished?

For example, lets say I have a 3rd party add-in that downloads data
from the internet and has a custom menu called Custom with a submenu
called Download. If I select download I would like to "catch" that it
was called and set application.enableevents to false and then whenever
it is done I would like to turn it back on.

Is this possible?
Thanks


Jim Cone[_2_]

Use event to catch the running of a macro from an add-in
 


First thing I would try is to see if you can determine the name of the
sub called by the Download menu item... View (menu) | Tools | Customize
and right-click the menu item and see what "assign macro" tells you.

If that works then substitute your own sub for the one assigned to the menu item.
'--
Sub MySubstitue()
On Error GoTo BadChoice
Application.EnableEvents = False
Call MacroAssignedToMenuItem
BadChoice:
Application.EnableEvents = True
End Sub
--

Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)





wrote in message
Is there a way to determine when a macro from a 3rd-party add-in has
started running and when it has finished?

For example, lets say I have a 3rd party add-in that downloads data
from the internet and has a custom menu called Custom with a submenu
called Download. If I select download I would like to "catch" that it
was called and set application.enableevents to false and then whenever
it is done I would like to turn it back on.

Is this possible?
Thanks


[email protected]

Use event to catch the running of a macro from an add-in
 
No luck - any other ideas?

Thanks

On May 6, 10:21 am, "Jim Cone" wrote:
First thing I would try is to see if you can determine the name of the
sub called by the Download menu item... View (menu) | Tools | Customize
and right-click the menu item and see what "assign macro" tells you.

If that works then substitute your own sub for the one assigned to the menu item.
'--
Sub MySubstitue()
On Error GoTo BadChoice
Application.EnableEvents = False
Call MacroAssignedToMenuItem
BadChoice:
Application.EnableEvents = True
End Sub
--

Jim Cone
Portland, Oregon USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


wrote in message
Is there a way to determine when a macro from a 3rd-party add-in has
started running and when it has finished?

For example, lets say I have a 3rd party add-in that downloads data
from the internet and has a custom menu called Custom with a submenu
called Download. If I select download I would like to "catch" that it
was called and set application.enableevents to false and then whenever
it is done I would like to turn it back on.

Is this possible?
Thanks



Jim Cone[_2_]

Use event to catch the running of a macro from an add-in
 

I failed to renew my psychic hotline subscription.
No luck means what? ...
Couldn't find a macro name? or the MySubstitute sub failed at the "something"
line with a "description here" error? or Excel crashed? or ...
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




wrote in message
No luck - any other ideas?
Thanks


On May 6, 10:21 am, "Jim Cone"
wrote:
First thing I would try is to see if you can determine the name of the
sub called by the Download menu item... View (menu) | Tools | Customize
and right-click the menu item and see what "assign macro" tells you.

If that works then substitute your own sub for the one assigned to the menu item.
'--
Sub MySubstitute()
On Error GoTo BadChoice
Application.EnableEvents = False
Call MacroAssignedToMenuItem
BadChoice:
Application.EnableEvents = True
End Sub
--

Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




wrote in message
Is there a way to determine when a macro from a 3rd-party add-in has
started running and when it has finished?

For example, lets say I have a 3rd party add-in that downloads data
from the internet and has a custom menu called Custom with a submenu
called Download. If I select download I would like to "catch" that it
was called and set application.enableevents to false and then whenever
it is done I would like to turn it back on.

Is this possible?
Thanks



Tim Williams

Use event to catch the running of a macro from an add-in
 
As far as I know there's no way to put a "watch" on a particular macro so
you can know when it runs (and any watching code could not run at the same
time as the watched macro...)

If you just want to make the 3rd party code complete more quickly then you
could wrap a call to it in another sub and call it via that.

Eg:

Sub Wrapper()
application.enableevents=false
application.run ThirdPartyMacroName
application.enableevents=true
end sub

However if the 3rd party macro switches event handling back on you can't
prevent that. Also, if it operates asynchronously your timing will be off.

Tim


wrote in message
...
Is there a way to determine when a macro from a 3rd-party add-in has
started running and when it has finished?

For example, lets say I have a 3rd party add-in that downloads data
from the internet and has a custom menu called Custom with a submenu
called Download. If I select download I would like to "catch" that it
was called and set application.enableevents to false and then whenever
it is done I would like to turn it back on.

Is this possible?
Thanks




[email protected]

Use event to catch the running of a macro from an add-in
 
No luck meaning that I can't see the name of the sub. The macro is
called by a dll so I don't know how to figure out what call that is.
I am guessing it just isn't possible.

Thanks

On May 6, 2:50 pm, "Jim Cone" wrote:
I failed to renew my psychic hotline subscription.
No luck means what? ...
Couldn't find a macro name? or the MySubstitute sub failed at the "something"
line with a "description here" error? or Excel crashed? or ...
--
Jim Cone
Portland, Oregon USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


wrote in message
No luck - any other ideas?
Thanks

On May 6, 10:21 am, "Jim Cone"

wrote:
First thing I would try is to see if you can determine the name of the
sub called by the Download menu item... View (menu) | Tools | Customize
and right-click the menu item and see what "assign macro" tells you.


If that works then substitute your own sub for the one assigned to the menu item.
'--
Sub MySubstitute()
On Error GoTo BadChoice
Application.EnableEvents = False
Call MacroAssignedToMenuItem
BadChoice:
Application.EnableEvents = True
End Sub
--


Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



wrote in message
Is there a way to determine when a macro from a 3rd-party add-in has
started running and when it has finished?


For example, lets say I have a 3rd party add-in that downloads data
from the internet and has a custom menu called Custom with a submenu
called Download. If I select download I would like to "catch" that it
was called and set application.enableevents to false and then whenever
it is done I would like to turn it back on.


Is this possible?
Thanks



Jim Cone[_2_]

Use event to catch the running of a macro from an add-in
 
Maybe, but it still all starts by clicking the "Download" menu item.
So run your own sub when you want to "download"...
'--
Sub MakeItHappen
On Error GoTo Snafu
Application.EnableEvents = False
Application.CommandBars(1).Controls("Custom").Cont rols("Download").Execute
Snafu:
Application.EnableEvents = True
End Sub
'--
Above assumes the Custom menu is on the menu bar.
Also, as Tim Williams pointed, out that you can't control whether the
Download routine switches Events back on or when it finishes.
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)






wrote in message
No luck meaning that I can't see the name of the sub. The macro is
called by a dll so I don't know how to figure out what call that is.
I am guessing it just isn't possible.
Thanks

On May 6, 2:50 pm, "Jim Cone"
wrote:
I failed to renew my psychic hotline subscription.
No luck means what? ...
Couldn't find a macro name? or the MySubstitute sub failed at the "something"
line with a "description here" error? or Excel crashed? or ...
--
Jim Cone
Portland, Oregon USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)





wrote in message
No luck - any other ideas?
Thanks




On May 6, 10:21 am, "Jim Cone"
wrote:
First thing I would try is to see if you can determine the name of the
sub called by the Download menu item... View (menu) | Tools | Customize
and right-click the menu item and see what "assign macro" tells you.
If that works then substitute your own sub for the one assigned to the menu item.
'--
Sub MySubstitute()
On Error GoTo BadChoice
Application.EnableEvents = False
Call MacroAssignedToMenuItem
BadChoice:
Application.EnableEvents = True
End Sub
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)





wrote in message
Is there a way to determine when a macro from a 3rd-party add-in has
started running and when it has finished?


For example, lets say I have a 3rd party add-in that downloads data
from the internet and has a custom menu called Custom with a submenu
called Download. If I select download I would like to "catch" that it
was called and set application.enableevents to false and then whenever
it is done I would like to turn it back on.
Is this possible?
Thanks




All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com