Re: message box when word opens
From: Dragon (chrisja_at_nospam.acgov.org)
Date: 03/12/04
- Next message: Peter Hewett: "Re: grouping actions for undo"
- Previous message: Jean-Guy Marcil: "Re: Open a template without running a macro"
- Next in thread: Charles Kenyon: "Re: message box when word opens"
- Reply: Charles Kenyon: "Re: message box when word opens"
- Reply: Peter Hewett: "Re: message box when word opens"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 12 Mar 2004 21:21:33 GMT
Hi Charles. How would you code it if you want it to run everytime any
document is opened? Putting it in the Normal.dot is not an option.
I have tried the following, but it only works when it is a new document
opening when WORD is opening. I am trying to turn on the SHOW/HIDE function
whenever the user openes any document. I have placed the following code in
an Template that is in the Start-up folder.
Option Explicit
Dim OpenDocs As Long
Sub autoexec()
OpenDocs = Documents.Count
If OpenDocs > 0 Then
ActiveWindow.View.ShowAll = True
End If
End Sub
Thanks!
Dragon
"Charles Kenyon" <msnewsgroup@remove.no.spam.addbalance.com> wrote in
message news:OsK7uoP7DHA.3024@tk2msftngp13.phx.gbl...
> If you want it to run when Word is started, but not everytime a document
is
> opened, put your code in a macro in normal.dot or another global template.
> The macro must be named AutoExec.
>
> I tend to store macros named AutoExec or AutoOpen, AutoNew, AutoClose in a
> separate module named AutoMacros because otherwise I end up with
multiples.
> --
>
> Charles Kenyon
>
> See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
> --------- --------- --------- --------- --------- ---------
> This message is posted to a newsgroup. Please post replies
> and questions to the newsgroup so that others can learn
> from my ignorance and your wisdom.
>
>
> "Mike" <csharpcoder@sbcglobal.net> wrote in message
> news:%23rtSz$N7DHA.2812@TK2MSFTNGP11.phx.gbl...
> > How can I get a macro to run when the user opens word template?
> > I want to display a message box when word is started.
> >
> > Here's my code i'm trying to execute;
> >
> > Private Sub Document_Open()
> > MsgBox "hey there"
> > End Sub
> > is this correct? I have it under
> > Normal --> Microsoft Word Object --> ThisDocument
> >
> > is that the correct spot to have this code, or should it be somewhere
> else?
> >
> >
> >
>
>
>
- Next message: Peter Hewett: "Re: grouping actions for undo"
- Previous message: Jean-Guy Marcil: "Re: Open a template without running a macro"
- Next in thread: Charles Kenyon: "Re: message box when word opens"
- Reply: Charles Kenyon: "Re: message box when word opens"
- Reply: Peter Hewett: "Re: message box when word opens"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|