A
Ailish
I'm struggling to resolve a problem that only crops up now and then. I'm
using Word 2007.
I have inserted a LastSavedBy field into a .docm file because I need to have
a (hidden text) record of which person last updated the contents of the file.
I have set that text as "Hidden" because I don't want it to get printed out.
Everything seems to go fine for a few updates but eventually the following
message appears when a user tries to open the most recent file to update it:
"The Office Open XML file "File Name" cannot be opened because there are
problems with the contents.
Details
Unspecified error
Location: Part: /word/document.xml, Line:2, Column: 202617"
It doesn't seem possible to predict when this message will appear, i.e. it
doesn't seem to happen after a particular number of updates or anything.
The Location always indicates Line2 which is where the LastSavedBy field is
and deleting that field is the only thing that ever resolves the problem -
but that leaves me without a record of who performed the update.
The .docm file is attached to a .dotm template.
In the past, I tried using a content control and running the macro below
when the user saved and closed the file. It worked fine for one update but
after that it gave rise to a similar message (different Details though).
Internet searches taught me that Word 2007 can't cope with having a field
inserted inside a content control.
Sub SavedBy()
Dim ccSavedBy As ContentControl
Dim strUserName As String
Set ccSavedBy = ActiveDocument.SelectContentControlsByTitle("Saved
By").Item(1)
'ccSavedBy.SetPlaceholderText Text:=" "
strUserName = Application.UserName
'ccSavedBy.Range.Text = strUserName
End Sub
Can anybody see what I'm doing wrong with the LastSavedBy field? Or offer
an alternative method of automatically recording who saves a file?
Thanks for any advice
Ailish
using Word 2007.
I have inserted a LastSavedBy field into a .docm file because I need to have
a (hidden text) record of which person last updated the contents of the file.
I have set that text as "Hidden" because I don't want it to get printed out.
Everything seems to go fine for a few updates but eventually the following
message appears when a user tries to open the most recent file to update it:
"The Office Open XML file "File Name" cannot be opened because there are
problems with the contents.
Details
Unspecified error
Location: Part: /word/document.xml, Line:2, Column: 202617"
It doesn't seem possible to predict when this message will appear, i.e. it
doesn't seem to happen after a particular number of updates or anything.
The Location always indicates Line2 which is where the LastSavedBy field is
and deleting that field is the only thing that ever resolves the problem -
but that leaves me without a record of who performed the update.
The .docm file is attached to a .dotm template.
In the past, I tried using a content control and running the macro below
when the user saved and closed the file. It worked fine for one update but
after that it gave rise to a similar message (different Details though).
Internet searches taught me that Word 2007 can't cope with having a field
inserted inside a content control.
Sub SavedBy()
Dim ccSavedBy As ContentControl
Dim strUserName As String
Set ccSavedBy = ActiveDocument.SelectContentControlsByTitle("Saved
By").Item(1)
'ccSavedBy.SetPlaceholderText Text:=" "
strUserName = Application.UserName
'ccSavedBy.Range.Text = strUserName
End Sub
Can anybody see what I'm doing wrong with the LastSavedBy field? Or offer
an alternative method of automatically recording who saves a file?
Thanks for any advice
Ailish