BuiltInDocumentProperties automation error

F

FotoArt

Hello everyone

the following line of macro code gives me an automation error when I open a
new document. I know its probably because the newfile is not saved yet. But I
have used condition such as, if 'saved' is not true not to run it. But doesnt
seem to work.

MyStamp = ActiveDocument.BuiltInDocumentProperties(wdPropertyTimeLastSaved)

Any help on how to deal with BuiltInDocumentProperties with no values will
be appreciated.

thanx
ahmed
 
L

Lene Fredborg

To prevent the error in relation to the wdPropertyTimeLastSaved property, you
could check the Path property of the active document - the path of a new and
never saved document is an empty string:

With ActiveDocument
If .Path <> "" Then
MyStamp = .BuiltInDocumentProperties(wdPropertyTimeLastSaved)
'Insert code to do what you want
Else
'If you want to do something in case of unsaved documents
'insert code here
End If
End With

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 

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