Solved

Check whether document has already been saved

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Free Online PDF Converter 2 60
VBA Shell can't Find Word document 11 94
recent docs in word and excel 3 46
Microsoft Word startup Issue 7 25
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…
A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
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 walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.

777 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