Reply
 
Thread Tools Display Modes
  #1   Report Post  
Chris Barbero Chris Barbero is offline
Junior Member
 
Posts: 0
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Define Range (Word 2003 VBA) bahtea New Users 0 September 23rd 10 03:53 AM
Can Word 2007 apply a zip code bar code to envelopes? LINDA Microsoft Word Help 4 January 5th 08 04:45 AM
My code isn't showing in code view ruthnann Microsoft Word Help 2 September 8th 07 09:16 PM
How can I see a text code, such as the code for 'line return'? Blackhawk Microsoft Word Help 3 January 26th 06 09:15 PM
Microworks asks for a code tahat I do not know. How do I get code Francisco Microsoft Word Help 1 November 23rd 05 09:01 PM


All times are GMT +1. The time now is 06:55 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"