Word 2002 Save Problem

D

Dazza

I am changing Document Custom Properties via my VB.NET code (see below) but when I perform the save on the document, word doesn't seem to recognise my changes and doesn't save the document ( i.e the date/time modified doesn't change and my alterations aren't applied ). I have checked the properties just before doing the save and they are as they should be. When the save is run it doesn't throw any exceptions.

When I do the same change manually everything works as it should.

I have also tried iDocument.Close(SaveChanges:=wdSaveChanges) and this doesn't force the changes to be saved. I have done similar code before on Word 2000 and it seemed to have no problems. Does anyone know how to touch the document so Word thinks it has been changed, without altering any of the content

Private iWordApplication As Objec

Public Sub SetDocProperties(ByVal pDoc As String, ByVal pProperties As Collection

Dim iDocument As Objec

Dim iDocProperty As DocPropert

' Open the Word documen
iDocument = iWordApplication.Documents.Open(pDoc

' Process every property in the properties collectio
For Each iDocProperty In pPropertie

' Determine if the property is a system property or a custom property. Call the appropriate subroutine
If isSystemProperty(iDocProperty.PropertyName) The
SetSystemProperty(iDocument, iDocProperty.PropertyName, ""
SetSystemProperty(iDocument, iDocProperty.PropertyName, iDocProperty.PropertyValue
Els
SetCustomProperty(iDocument, iDocProperty.PropertyName, ""
SetCustomProperty(iDocument, iDocProperty.PropertyName, iDocProperty.PropertyValue
End I

Next iDocPropert

' Save the word document and close it
iDocument.save(
iDocument.Close(SaveChanges:=0
iDocument = Nothin

End Sub
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?RGF6emE=?=,

First, a remark: this is an end-user's newsgroup. You'll have better luck for
this type of question in an office.developer or word.vba newsgroup.

My first recommendation would be to add some code that writes something into
the document, then deletes it, as a test. If you do that, then save, are the
changes to the document properties also saved?

Is all you want to do with these documents is change some properties, nothing
else? In that case, search the Knowledge Base on dsofile. Microsoft provides a
DLL that can get to document properties directly, without opening Office
documents. There might even be a way, with NET, to do this without the dll,
but I don't know for sure.
I am changing Document Custom Properties via my VB.NET code (see below) but
when I perform the save on the document, word doesn't seem to recognise my
changes and doesn't save the document ( i.e the date/time modified doesn't
change and my alterations aren't applied ). I have checked the properties just
before doing the save and they are as they should be. When the save is run it
doesn't throw any exceptions.
When I do the same change manually everything works as it should.

I have also tried iDocument.Close(SaveChanges:=wdSaveChanges) and this
doesn't force the changes to be saved. I have done similar code before on Word
2000 and it seemed to have no problems. Does anyone know how to touch the
document so Word thinks it has been changed, without altering any of the
content?
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top