Solved

Check whether document has already been saved

Posted on 2011-02-22
4
517 Views
Last Modified: 2012-05-11
Dear Experts:

I would like to get the following code snippet:

The macro should check ...
... whether the the current document has not been saved yet (ie. the document's name is just 'document1' or 'document2' etc.) .
If so the macro has to say so in a Msgbox and the macro is to exit.

If the document has already been saved the macro is to go on without coming up with any message.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
0
Comment
Question by:AndreasHermle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 34955156
Hi Andreas,

It might be best to test the Saved property. This is false between the time taht teh document is created or modified and it is saved.

Otherwise you can use this function.
Function IsSaved() As Boolean
    IsSaved = InStr(ActiveDocument.FullName, ".")
End Function

Open in new window

0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 34955193
Oops. It looks as if my left hand was faster than my right in the middle of the second sentence. I've just re-installed my OS, and I haven't added the Firefox spell-checker yet.
0
 

Author Comment

by:AndreasHermle
ID: 34955720
Hi Graham,

thank you very much for your swift reply. Will try it out and let you know tomorrow.

Regards, Andreas
0
 

Author Closing Comment

by:AndreasHermle
ID: 34962309
Works great, thank you Graham for the professional support. Regards, Andreas
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question