|
|
|
date: Fri, 15 Aug 2008 02:24:01 -0700,
group: microsoft.public.word.vba.general
back
Re: Exit Macro
At its most basic, the macros would look something like this:
Sub FileSave
Call MyExitMacro
ActiveDocument.Save
End Sub
Sub FileSaveAs
Call MyExitMacro
Dialogs(wdDialogFileSaveAs).Show
End Sub
These would go into any VBA module - most likely the one that already
contains your exit macro - and would effectively intercept the File | Save
and File | Save As commands. You would, of course, replace "MyExitMacro" with
the name of the exit macro you have already developed.
Note, too, that the "Call" statement is not absolutely necessary; I only
included it for clarity.
In addition, you may also have to do a bit of fiddling around with your exit
macro to make sure it can be invoked using this method if it's not in the
same module as the sample code above.
Using the Document_Close event as the trigger would be a bit more
complicated and requires an understanding of VBA that may be beyond the
current scope of your learning. I would recommend that you do a bit of study
before attempting this approach.
In fact, it probably wouldn't do any harm to build your knowledge generally
if you plan on doing more of this type of work. Forum members are all unpaid
volunteers and, while they are happy to help, you may find they get a bit...
testy... if you don't show a willingness to help yourself in the first
instance. Otherwise, I would suggest engaging an outside resource to assist
you.
--
Cheers!
Gordon
Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
"ah" wrote:
> Hi Gordon;
>
> Thanks for your reply.
> This sounds good. I would appreciate if you could provide me with the code
> as I'm not familiar with macro coding.
>
> Thanks in advance.
>
> "Gordon Bentley-Mix" wrote:
>
> > You could also possibly try calling the exit macro in a FileSave, FileSaveAs
> > or Document_Close macro...
> > --
> > Cheers!
> > Gordon
> >
> > Uninvited email contact will be marked as SPAM and ignored. Please post all
> > follow-ups to the newsgroup.
> >
> >
> > "Graham Mayor" wrote:
> >
> > > If you don't exit the field the exit macro won't run - that's why its called
> > > an exit macro! Use any entry macro to tell the user to tab out of the field.
> > >
> > > Sub PopUpAdvice()
> > > Dim sMsg As String
> > > sMsg = "Tab out of this field on completion," & vbCr & _
> > > "to ensure that it is correctly formatted"
> > > MsgBox sMsg, vbOKOnly, "User instructions"
> > > End Sub
> > >
> > >
> > > --
> > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > > Graham Mayor - Word MVP
> > >
> > > My web site www.gmayor.com
> > > Word MVP web site http://word.mvps.org
> > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > >
> > >
> > > ah wrote:
> > > > I've inserted a macro to capture the value as negative amount when I
> > > > exit the amount field.
> > > >
> > > > However, I found that the user did not leave the field before they
> > > > save the file. As a result, the macro is not running since they did
> > > > not exit that field.
> > > >
> > > > Please advice what should I do to ensure that the macro is running
> > > > even when the suer did not exit that field.
> > > >
> > > > Thanks a lot!
> > >
> > >
> > >
date: Mon, 18 Aug 2008 20:37:00 -0700
author: Gordon Bentley-Mix gordon(dot)bentleymix(at)gmail(dot)com
Re: Exit Macro
Hi Gordon;
Thanks a lot for your kind help!!!
It works and I'm so excited!
Thanks a lot!
Regards;
A.H
"Gordon Bentley-Mix" wrote:
> At its most basic, the macros would look something like this:
>
> Sub FileSave
> Call MyExitMacro
> ActiveDocument.Save
> End Sub
>
> Sub FileSaveAs
> Call MyExitMacro
> Dialogs(wdDialogFileSaveAs).Show
> End Sub
>
> These would go into any VBA module - most likely the one that already
> contains your exit macro - and would effectively intercept the File | Save
> and File | Save As commands. You would, of course, replace "MyExitMacro" with
> the name of the exit macro you have already developed.
>
> Note, too, that the "Call" statement is not absolutely necessary; I only
> included it for clarity.
>
> In addition, you may also have to do a bit of fiddling around with your exit
> macro to make sure it can be invoked using this method if it's not in the
> same module as the sample code above.
>
> Using the Document_Close event as the trigger would be a bit more
> complicated and requires an understanding of VBA that may be beyond the
> current scope of your learning. I would recommend that you do a bit of study
> before attempting this approach.
>
> In fact, it probably wouldn't do any harm to build your knowledge generally
> if you plan on doing more of this type of work. Forum members are all unpaid
> volunteers and, while they are happy to help, you may find they get a bit...
> testy... if you don't show a willingness to help yourself in the first
> instance. Otherwise, I would suggest engaging an outside resource to assist
> you.
> --
> Cheers!
> Gordon
>
> Uninvited email contact will be marked as SPAM and ignored. Please post all
> follow-ups to the newsgroup.
>
>
> "ah" wrote:
>
> > Hi Gordon;
> >
> > Thanks for your reply.
> > This sounds good. I would appreciate if you could provide me with the code
> > as I'm not familiar with macro coding.
> >
> > Thanks in advance.
> >
> > "Gordon Bentley-Mix" wrote:
> >
> > > You could also possibly try calling the exit macro in a FileSave, FileSaveAs
> > > or Document_Close macro...
> > > --
> > > Cheers!
> > > Gordon
> > >
> > > Uninvited email contact will be marked as SPAM and ignored. Please post all
> > > follow-ups to the newsgroup.
> > >
> > >
> > > "Graham Mayor" wrote:
> > >
> > > > If you don't exit the field the exit macro won't run - that's why its called
> > > > an exit macro! Use any entry macro to tell the user to tab out of the field.
> > > >
> > > > Sub PopUpAdvice()
> > > > Dim sMsg As String
> > > > sMsg = "Tab out of this field on completion," & vbCr & _
> > > > "to ensure that it is correctly formatted"
> > > > MsgBox sMsg, vbOKOnly, "User instructions"
> > > > End Sub
> > > >
> > > >
> > > > --
> > > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > > > Graham Mayor - Word MVP
> > > >
> > > > My web site www.gmayor.com
> > > > Word MVP web site http://word.mvps.org
> > > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > > >
> > > >
> > > > ah wrote:
> > > > > I've inserted a macro to capture the value as negative amount when I
> > > > > exit the amount field.
> > > > >
> > > > > However, I found that the user did not leave the field before they
> > > > > save the file. As a result, the macro is not running since they did
> > > > > not exit that field.
> > > > >
> > > > > Please advice what should I do to ensure that the macro is running
> > > > > even when the suer did not exit that field.
> > > > >
> > > > > Thanks a lot!
> > > >
> > > >
> > > >
date: Tue, 19 Aug 2008 23:45:01 -0700
author: ah
|
|