MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Suppressing "Open Read Only" Question....


Posted by Uttam on April 27, 2001 6:19 AM

Hello,

Actually two questions:

1) Is there some way of suppressing "Open Read Only" question when a file is opened with a Macro? (I want people to choose "Read Only" all the time.)

2) Is there some way of suppressing "Save Changes" Question when a file is closed with a Macro? (I want people to choose "Don't Save" option all the time..)

Thanks in Advance


Posted by Uttam on April 27, 2001 6:37 AM

Re: Suppressing

Just to clarify matters:

I use this syntax:

Workbooks.Open Filename:= _
ThisFile

Where ThisFile contains the filename

ActiveWorkbook.Close


Posted by Ivan Moala on April 27, 2001 7:06 AM

Re: Suppressing

Back in the good ole' Lotus days I was able to create a cell in my worksheets with a formula for the complete file path. I could name the cell "path" that contained the formula and by using let's say \path in the footer section the file path appeared on each page of my printouts. I haven't been able to unlock the secret of how to put the file path in the footer except by means of manually keying in the information. There has got to be a better way, doesn't there?

Posted by Ivan Moala on April 27, 2001 7:10 AM

Re: Suppressing

1) Workbooks.Open "YourFileName", ReadOnly:=True
2) ActiveWorkbook.Saved = True


Ivan

Posted by Uttam on April 27, 2001 8:39 AM

Re: Suppressing

======================
Thanks but...

ActiveWorkbook.Saved = True

will this not Save the file? I want to do the opposite...

This is the background..

I am trying a few syntaxes myself.. but have not been successful.. Can you help Ivan...? or someone else...?

Thanks

Posted by Ivan Moala on April 27, 2001 9:01 AM

Re: Suppressing

Seting a workbook to saved = true tells excel
that this workbook has already been saved and will
not prompt you to save changes.

Ivan

Posted by Stephane Parent on April 27, 2001 9:19 AM

Hi Uttam

from what I understand, you could insert this line at the beginning of your macro:

Application.DisplayAlerts = False

Just be sure the set it back to true at the end.

Stephane Parent

Posted by Uttam on April 27, 2001 11:03 AM

Hello Stephane,

Your method works exactly the way I want it to work.

Thanks a lot..

Uttam

================= Hi Uttam from what I understand, you could insert this line at the beginning of your macro: Application.DisplayAlerts = False Just be sure the set it back to true at the end. Stephane Parent