hiding a macro button on document

G

Guest

I have created a template which has a specific save button to an imaging
system.
When a new document is opened from the template the macro is there and saves
the word doc to it's designated area in native format to be workable there,
however at that point I do not want the macro available.

Any ideas on how to 'hide' the macro button ?

Thanks,
Bryan
 
G

Guest

If the button is never going to be used anymore in that document once the
user has clicked it, you could build additional code into the macro that
deletes the button.

I just made a test with both a MacroButton field and a CommandButton
(created via the Control Toolbox). I placed the field/button in a separate
paragraph and added this code line:

Selection.Paragraphs(1).Range.Delete

to the end of my test macro. In both cases, it worked fine – after executing
the first part of the macro, the field/button paragraph was removed.

An alternative solution could be to let the macro change the font of the
button to hidden. However, you would then also have to build in code that
keeps track of the users' settings as regards hidden text – otherwise, the
hidden text may be visible on the screen as well as on print.

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
G

Guest

My apology,
I should have included that the 'Save' button is customized in the toolbar.
 
G

Guest

I see. Then you need something else. A suggestion (the easiest approach as
far as I can see):

If the macro is always and only to be executed when creating a new document
based on the template, you could rename you macro to AutoNew or create a
macro named AutoNew that calls your macro. This would force your macro to run
whenever a new document is created based on that template. If needed, you
could insert a MsgBox that provides the user with information or prompt the
user for e.g. a yes or no (and then act accordingly in the macro). Then you
could remove the Save button from the toolbar. Once a document is created,
the AutoNew will not run anymore.

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
G

Guest

As a novice thus far with working vb in Word and Excel, I'm a bit confused on
what to do. I have the 'Save to IR' button in the toolbar. This uses the
macor ir.
Am I to have this button use a macro 'AutoNew' which calls ir() ?

Thanks,
Bryan
 
G

Guest

Try this:
Rename your macro "ir" to "AutoNew". As a test, insert the following code
line in the start of the AutoNew macro:

MsgBox "IR macro running now"

Save the template. Try to create a new document based on the template. If
everything works, the message "IR macro running now" will pop up - this tells
you that the AutoNew macro is actually running. In that case, you could
simply remove your "Save to IR" button from the toolbar since the AutoNew
macro will take care of what needs to be done (remember to delete the MsgBox
line from your macro again).

Hope this helps. If not, I will most likely not be able to return with more
help until Sunday.

---
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
G

Guest

So how do I save the doument to our Imaging system?
In the ir button I extrapolate info from the doc such as client number and
then add other info to the file name to save to a specific location.

Once the workable document is in ImageRight I then would prefer that the
save to ir button is gone.
If you would like to see the template and the coding behind I could attach
in an e-mail.

Thanks,
Bryan
 
G

Guest

Sorry, Bryan, but I don't think I am able to help you. I don't know your
Imaging system.

My idea with the AutoNew method was that you could simply use exactly the
same macro as you already do – the only difference was the macro name.

It may be helpful to read more about Auto Macros. Look up "Auto Macros" in
the VBA help and read the article at:
http://word.mvps.org/faqs/macrosvba/DocumentEvents.htm

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
G

Guest

Let's put it this way.
When I run the template it creates a new doc. Some of the information that I
type on the document will be the file name. Let's say I type Bryan in a text.
When I 'Save to IR' I could put it to my C: drive as Bryan.doc. When I open
Bryan.doc, I don't wan't the 'Save to IR' to display.

If that helps.

Thanks,
Bryan
 
G

Guest

I understand.
The problem is that the "Save" button in the toolbar needs to be there for
other new documents you create based on the template. This means that
sometimes it must be shown/enabled, sometimes not. It is possible to handle
that but it is not that easy. Therefore, I suggested the AutoNew approach
(and suggested that you get rid of the toolbar button).

What information do you need to enter in the document before you save macro
is run? You could use Inbutboxes (or a user form) from an AutoNew macro to
prompt the user for the information required.

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top