Solved

Check whether document has already been saved

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now