Greetings,
I am running Word 2000. I have a macro that runs when the document is
opened.
It displays a msgbox. I would like to put a check in to see if the name of
the current
document matches a given string.
ie,
if currentdocument.name eq 'z:\documentstore\mydoc.doc' then
msgbox "Please use SAVE AS to rename this document before typing in this
form", , "SAVE AS"
what is the appropriate syntax to achieve this ?
thanks,
D
Greg - 31 Mar 2006 02:26 GMT
D,
Something along this line:
Sub AutoOpen()
Dim pString As String
pString = "What ever the name is"
If ActiveDocument.FullName = pString Then
MsgBox "Whatever message you want"
End If
End Sub
Shauna Kelly - 31 Mar 2006 10:28 GMT
Hi Darryl
Let's try to solve the real problem, rather than the symptom.
It sounds like you're creating a form for people to fill in. And you don't
want them to type in the original form. Instead, you want them to create a
new document for themselves (and you want them to do this using File > Save
As), and type in that document.
Is that the story?
If so, you may be better off turning your document into a template. To do
that, open your document and do File > Save As and save it as a template.
Store the template somewhere that everyone can access, and mark it read
only.
If you put it in the folder identified at Tools > Options > File Locations >
User Templates *or* > Workgroup Templates, then the user can do File > New
and choose your form. Word will automatically create a new document from
your template, and the user can save it as they choose.
If you put it somewhere else, then the user can use Windows Explorer and
double-click the file name to create a new document from the template. Or,
put a shortcut to the template on your desktop.
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
> Greetings,
> I am running Word 2000. I have a macro that runs when the document is
[quoted text clipped - 13 lines]
> thanks,
> D