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?
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?
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" <Losse.1s0gaz_1121094972.5272@excelforum-nospam.com> wrote in
message news:Losse.1s0gaz_1121094972.5272@excelforum-nospam.com...
>
> 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
>
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
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" <Losse.1s0lvi_1121101722.8514@excelforum-nospam.com> wrote in
message news:Losse.1s0lvi_1121101722.8514@excelforum-nospam.com...
>
> 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
>
Sorry, meant
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Call SaveMacro
End Sub
--
HTH
Bob Phillips
"Bob Phillips" <phillips@tiscali.co.uk> wrote in message
news:uVPDgGkhFHA.1244@TK2MSFTNGP14.phx.gbl...
> 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" <Losse.1s0lvi_1121101722.8514@excelforum-nospam.com> wrote in
> message news:Losse.1s0lvi_1121101722.8514@excelforum-nospam.com...
> >
> > 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
> >
>
>
Thank you. Is there also an event that happens before a macro is run or the macro screen is selected?
Which macro, yours or the BeforePrint event?
--
HTH
Bob Phillips
"Losse" <Losse.1s25hu_1121173780.2124@excelforum-nospam.com> wrote in
message news:Losse.1s25hu_1121173780.2124@excelforum-nospam.com...
>
> 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
>
I was referring to when the user goes to tools.>macro. Is there an event before the choices of the macros to select appears?
No.
--
HTH
Bob Phillips
"Losse" <Losse.1s408a_1121260248.2549@excelforum-nospam.com> wrote in
message news:Losse.1s408a_1121260248.2549@excelforum-nospam.com...
>
> 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
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks