Re: AutoOpen Macro Not Showing Toolbar
From: Montana DOJ Help Desk (NoEmailReplies_at_Please.com)
Date: 11/25/04
- Next message: Slow Learner: "Setting Command Button in Word Document"
- Previous message: Vince: "Re: Wild Character Expression in word"
- In reply to: Jean-Guy Marcil: "Re: AutoOpen Macro Not Showing Toolbar"
- Next in thread: Jean-Guy Marcil: "Re: AutoOpen Macro Not Showing Toolbar"
- Reply: Jean-Guy Marcil: "Re: AutoOpen Macro Not Showing Toolbar"
- Reply: Peter: "Re: AutoOpen Macro Not Showing Toolbar"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Nov 2004 18:34:34 -0700
> His problem, I think, was caused by his using
> Toolbar("Name").Visible = False
> in his AutoClose macro. Had he used the same code in a Document_Close
macro,
> he would have had the same problem.
I decided to test this theory. First, I added
Toolbar("Name").Visible = False
to my Document_Close routine. When I opened the document the Document_Open
routine displayed the toolbar. Next, I created AutoOpen and AutoClose
routines using exactly the same code as the Document_Open and Document_Close
routines, and then I deactivated Document_Open and Document_Close to avoid
conflicts with the auto macros. I tried AutoClose with, and without, the
above command, and in both cases the AutoOpen routine failed to display the
toolbar when the document was opened.
Next, I eliminated the AutoClose routine entirely, so that nothing was
running when the document closed. I also reduced AutoOpen to the following
(previously, I had one other command, but it was just setting a variable
value):
Private Sub AutoOpen()
CommandBars("Locates").Visible = True
End Sub
Still, AutoOpen did not display the toolbar when the document was opened.
Then it suddenly occurred to me that I had made AutoOpen a private routine.
So I removed "Private" from the above routine, and it worked!
I guess that makes sense because AutoOpen would have to be called from
outside of the module, and since the Private keyword makes a macro
unavailable from outside of the module, the routine simply wasn't getting
run.
This explains why I was certain that the routine worked when I first wrote
it over a year ago. At that time, I didn't know about make routines
private, so it was a public routine. When I discovered how to make private
routines, I went through my project and made a bunch of them private in
order to prevent them from appears in the Tools > Macro > Macros dialog box
in Word (to prevent users from routines that are not designed to be run
directly). That was a while back, and I obviously didn't think to test my
auto macros after making them private.
-- Tom
State of Montana
Department of Justice Help Desk
- Next message: Slow Learner: "Setting Command Button in Word Document"
- Previous message: Vince: "Re: Wild Character Expression in word"
- In reply to: Jean-Guy Marcil: "Re: AutoOpen Macro Not Showing Toolbar"
- Next in thread: Jean-Guy Marcil: "Re: AutoOpen Macro Not Showing Toolbar"
- Reply: Jean-Guy Marcil: "Re: AutoOpen Macro Not Showing Toolbar"
- Reply: Peter: "Re: AutoOpen Macro Not Showing Toolbar"
- Messages sorted by: [ date ] [ thread ]