Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2005

Tip: Looking for answers? Try searching our database.

How to tell if macro has been executed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JonSteng - 15 Aug 2005 14:37 GMT
I have a series of macros that offers the user options to run all or only
part of the macros. It opens with a form that has check boxes with three
selections (Insert Table of Contents, add Frame and add Page Border) and the
user can select all or only one, etc.

The program runs fine the first time through, but if it is run again it can
get messy if options already run are chosen again.

Is there a way that I can check to see if a selection has been executed,
even if the document has been closed and re-opened?

Thank you.
Chuck Henrich - 15 Aug 2005 18:14 GMT
You could set a flag in the document when each option is chosen and executed.
Your code would first test for the existence/value of your flag and then
proceed based on what it found, and setting an appropriate flag when it is
done (successful or not).

Three types of flags come to mind (all explained in VBE help):

custom document properties - good if you want to be able to modify the flag
manually as well as by code but not usable if the document is protected in
any way

document variables - good if you don't want users to mess with the flag or
accidentally delete it (as they might with a bookmark), also good if the
document is protected, but not manipulable by hand (only by code)

bookmarks - good if you need to be able to find and work with
ranges/selections

Which one you use depends on what you want to do.

HTH
Signature

Chuck Henrich
www.ProductivityApps.com

> I have a series of macros that offers the user options to run all or only
> part of the macros. It opens with a form that has check boxes with three
[quoted text clipped - 8 lines]
>
> Thank you.
JonSteng - 15 Aug 2005 19:00 GMT
Thank you very much - after posting my question I researched some more and
started to work with the custom document properties, but your suggestion for
the document variables seems much cleaner and safer. After just a bit of
testing it will work out to do exactly what I need.

Thanks again,

Jon

> You could set a flag in the document when each option is chosen and executed.
>  Your code would first test for the existence/value of your flag and then
[quoted text clipped - 30 lines]
> >
> > Thank you.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.