Solved

Check whether document has already been saved

Posted on 2011-02-22
4
516 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Suggested Courses

738 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