How do I know if a doc is saved on disk

D

David Thielen

Hi;

How can I tell if a document is saved to disk. I know about Document.Saved
that tells me if it's dirty. But how do I tell if:

1) It is a new document that has never been saved to disk and therefore no
file by that name exists.

2) It is embedded in something and there is no actual word file on disk.
 
P

Peter Huang [MSFT]

Hi

1) It is a new document that has never been saved to disk and therefore no
file by that name exists.

I think you may try to check the Saved and the FullName Property.
Sub Test()
Debug.Print ThisDocument.Saved
Debug.Print ThisDocument.FullName
End Sub

BTW: We can not guarantee that a word file with certain filename is on the
disk, because any file we can rename it as xxxx.doc, except we search all
the disk to ensure that there is not file of the name.

2) It is embedded in something and there is no actual word file on disk.
Do you mean open the doc file in IE which is embeded?
If so, the document should have existed.
Can you describe the scenario more detailed?


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

David Thielen

I should have thought of this at first - I just call
File.Exist(Document.FullName)
 
P

Peter Huang [MSFT]

Hi

Thanks for your quickly reply!
That will benefit the community.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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