Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Using VBA code in MS Word
I am having a problem using VBA in MS Word. For some reason my simple code works when I open a file but does not work if the file is a hyperlink on our company intranet.
I have a form called Request.doc with a field that it todays date using the format yymmddhhmm. Every time the file opens the number changes. I want the number to lock when a user closes the file at the same time he/she renames the file. My code is below. Again the code executes if I open Request.doc, but it does not work if Request.doc is a hyperlink on our compnay intranet. Sub Document_Close() If ActiveDocument.Name = "ThisDocument.doc" Then ActiveDocument.Unprotect Password:="Siltronic" ActiveDocument.Fields.Locked = True ActiveDocument.Protect Password:="Siltronic", NoReset:=False, Type:= _ wdAllowOnlyRevisions ActiveDocument.Fields.Unlink End If End Sub Can someeon pelse exaplin why and offer a solution? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help Define Range (Word 2003 VBA) | New Users | |||
Can Word 2007 apply a zip code bar code to envelopes? | Microsoft Word Help | |||
My code isn't showing in code view | Microsoft Word Help | |||
How can I see a text code, such as the code for 'line return'? | Microsoft Word Help | |||
Microworks asks for a code tahat I do not know. How do I get code | Microsoft Word Help |