ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Starting a Macro when Command is Executed? (https://www.excelbanter.com/excel-programming/334158-starting-macro-when-command-executed.html)

Losse[_5_]

Starting a Macro when Command is Executed?
 

Is there anyway for me to have a macro run automatically whenever an
action is done on Excel? For example, could I set up a macro that saves
the file to automatically run whenever I print?


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386133


Bob Phillips[_7_]

Starting a Macro when Command is Executed?
 
You can trap events and fire your macro from there. For instance, there is a
BeforePrint event. See http://www.cpearson.com/excel/events.htm, it says
Excel97 but it is still valid.

--
HTH

Bob Phillips

"Losse" wrote in
message ...

Is there anyway for me to have a macro run automatically whenever an
action is done on Excel? For example, could I set up a macro that saves
the file to automatically run whenever I print?


--
Losse
------------------------------------------------------------------------
Losse's Profile:

http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386133




Losse[_6_]

Starting a Macro when Command is Executed?
 

How would I get it to run automatically as soon as an event occurs?
doubt this would work, but could I do something with a similar ide
to:

If Workbook_BeforePrint = true Then
Call "SaveMacro"
End I

--
Loss
-----------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...fo&userid=2481
View this thread: http://www.excelforum.com/showthread.php?threadid=38613


Bob Phillips[_7_]

Starting a Macro when Command is Executed?
 
No it would be something like

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Call "SaveMacro"
End Sub

Read the link I gave you.

--
HTH

Bob Phillips

"Losse" wrote in
message ...

How would I get it to run automatically as soon as an event occurs? I
doubt this would work, but could I do something with a similar idea
to:

If Workbook_BeforePrint = true Then
Call "SaveMacro"
End If


--
Losse
------------------------------------------------------------------------
Losse's Profile:

http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386133




Bob Phillips[_7_]

Starting a Macro when Command is Executed?
 
Sorry, meant

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Call SaveMacro
End Sub


--
HTH

Bob Phillips

"Bob Phillips" wrote in message
...
No it would be something like

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Call "SaveMacro"
End Sub

Read the link I gave you.

--
HTH

Bob Phillips

"Losse" wrote in
message ...

How would I get it to run automatically as soon as an event occurs? I
doubt this would work, but could I do something with a similar idea
to:

If Workbook_BeforePrint = true Then
Call "SaveMacro"
End If


--
Losse
------------------------------------------------------------------------
Losse's Profile:

http://www.excelforum.com/member.php...o&userid=24813
View this thread:

http://www.excelforum.com/showthread...hreadid=386133






Losse[_7_]

Starting a Macro when Command is Executed?
 

Thank you. Is there also an event that happens before a macro is run or
the macro screen is selected?


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386133


Bob Phillips[_7_]

Starting a Macro when Command is Executed?
 
Which macro, yours or the BeforePrint event?

--
HTH

Bob Phillips

"Losse" wrote in
message ...

Thank you. Is there also an event that happens before a macro is run or
the macro screen is selected?


--
Losse
------------------------------------------------------------------------
Losse's Profile:

http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386133




Losse[_11_]

Starting a Macro when Command is Executed?
 

I was referring to when the user goes to tools.macro. Is there an even
before the choices of the macros to select appears

--
Loss
-----------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...fo&userid=2481
View this thread: http://www.excelforum.com/showthread.php?threadid=38613


Bob Phillips[_7_]

Starting a Macro when Command is Executed?
 
No.

--
HTH

Bob Phillips

"Losse" wrote in
message ...

I was referring to when the user goes to tools.macro. Is there an event
before the choices of the macros to select appears?


--
Losse
------------------------------------------------------------------------
Losse's Profile:

http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386133





All times are GMT +1. The time now is 08:32 PM.

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