Re: Changing Locked property of Fields in Doc without using Docume
- From: mansky99 <mansky99@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 24 Apr 2006 18:40:02 -0700
Thanks Peter, that's a good idea. I suspect that indeed I'll have to use the
method Documents.Open to interrogate a given document to know if it even
has fields, and then parse thru the fields in a given document to toggle the
Locked
property to True if it's False. Looks like for the case of a document with
multiple Date
Fields in a document, I'll lose the original dates in those fields once I
open the document.
Thanks for the help!
Ed
"Peter Jamieson" wrote:
Although I can't see a way to open the document via Word without Word.
updating the date fields, on the Windows version I think it would be
possibel to inspect the value of
ActiveDocument.BuiltInDocumentProperties(wdPropertyTimeLastSaved), extract
the date from that, and stuff it programmatically into the document.
Or maybe something along those lines...
Peter Jamieson
"mansky99" <mansky99@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:696D2110-7F29-409A-BD0F-D7FBB577D972@xxxxxxxxxxxxxxxx
Hi,
I have a User who, by mistake, used a Date Field in Word documents to
place
a date in a document. The intention was to have that date to be fixed and
unchanged
the next time the document was opened. The dates are journal entries (ie.
a
date and some text)
and hence it's important that the dates remain unchanged upon subsequent
use
of the file.
I have a script to go thru all the Word docs on the machine where the
problem resides.
However, it appears that I have to first use the method Documents.Open
before I can use the method Documents.Fields.Count to see if there are any
fields in a given document.
Here's a code snippet of the script to toggle the Locked property of all
fields in a given document
from False to True :
For i = 1 To NF
Fullname = Pathnames(i) & Filenames(i)
Documents.Open Filename:=Fullname
If (Documents(Fullname).Fields.Count > 0) Then
For Each ADF In Documents(Fullname).Fields
If (ADF.Locked = False) Then
ADF.Locked = True
Documents.Close SaveChanges:=wdSaveChanges
Else
Documents.Close SaveChanges:=wdDoNotSaveChanges
End If
Next ADF
End If
Loop i
where the Variant arrays Pathnames and Filenames contain the paths and
filenames of all the
Word documents on the affected machine.
The problem is that as soon as Documents.Open is called, the date fields
(as
per design) are updated, thereby nullifying my script.
I'd like to change the Locked property value of any fields in a given
document from False to True
(to thereby prevent subsequent updating of date fields), but I can't seem
to
get around using
Documents.Open. If I leave out the call to Documents.Open, I get a 'Bad
filename' error from the
Documents(Fullname).Fields.Count statement.
Any ideas on how to toggle the Locked property, or other ideas would be
greatly appreciated!
Ed
- Follow-Ups:
- Re: Changing Locked property of Fields in Doc without using Docume
- From: Peter Jamieson
- Re: Changing Locked property of Fields in Doc without using Docume
- References:
- Re: Changing Locked property of Fields in Doc without using Documents.
- From: Peter Jamieson
- Re: Changing Locked property of Fields in Doc without using Documents.
- Prev by Date: Asian Fonts
- Next by Date: Re: Changing Locked property of Fields in Doc without using Docume
- Previous by thread: Re: Changing Locked property of Fields in Doc without using Documents.
- Next by thread: Re: Changing Locked property of Fields in Doc without using Docume
- Index(es):
Relevant Pages
|