|
|
|
date: Wed, 07 Nov 2007 07:11:55 -0800,
group: microsoft.public.word.vba.beginners
back
Re: Open a userform when word opens and on New documents??
I would really suggest that you create a template that already contains the
field to return the path and filename in the footer.
Otherwise, create a macro named AutoNew() that contains the following code:
Dim Msg, Style, Title, Response, MyString
Msg = "Do you want to include the file and pathname in the footer of the
document?" ' Define message.
Style = vbYesNo + vbQuestion + vbDefaultButton1 ' Define buttons.
Title = "File and Pathname" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
With ActiveDocument
.Fields.Add
Range:=.Sections(1).Footers(wdHeaderFooterPrimary).Range, _
Type:=wdFieldFileName, Text:="\p"
End With
End If
Probably best if that is created in a template that you save in the Word
Startup folder so that it is loaded as an addin.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"steve" wrote in message
news:1194809426.406667.321160@22g2000hsm.googlegroups.com...
> In our organization we are often finding documents in the physical
> files and wondering where the software version is. So what we want to
> do is simply put the filename at the bottom of documents that are
> created (from now on). Many of the users are not power users, that is
> the time and marginal complexity of putting a footer in a document and
> then putting the filename is either to much for them, or they are too
> lazy to do it. Frankly how many times have I not done it only to hate
> myself for not doing it. So we want to have a pop up box that asks
> when they start word or create a new document if they want to put the
> filename in the footer. They can click no or yes or full name and
> path.
>
> I have read on the news groups and it appears that putting the footer
> directly in the template is bad. (normal.dot) that is because it
> screws up some programs eg if your making labels. So I want to give
> people the option of whether they want it or not.
>
> By the way I have subsequetly learned about the "on time " And have
> used it to get the autoexec to work the way I want it to.
>
> Thats basically the problem. Dont you'all have users and problems like
> that? How do you deal with it other than, searching or telling your
> users you lost it you find it. (Im in the IT dept so I dont have that
> luxury if I like my job :).
>
> Regards
>
date: Mon, 12 Nov 2007 08:48:23 +1000
author: Doug Robbins - Word MVP
|
|