Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Open file ready only

I have code that on the Auto_Open it will run test to see if the file is read
only and if not then will make it ready only. The issue is that when you go
to ready only it will ask if you want to save the file. I do not because I
want the file only ready only from the beginning. What I did is make a
second file and on the Before_Save I test the name of the file and if it is
the name of the final file I am using I Cancel the Save. So I complete my
setup file and then I go to windows and make a copy and name it my final
file. So basically the user enters the file....in the Auto_Open it sets
DisplayAlerts to False ... then changes file to ready only ... the file wants
to save and since it is now the name of the file that I am testing and
Cancelling in the Before_Save it will not save and will switch to ReadOnly
with out saving and without displaying alerts. I also have cancelled out the
SaveAs..

Is this the best way to handle this or is there a way to tell a file to open
directly ReadOnly.

Note: I do not want to do Recommend Read Only. I want the file to open
and be forced to Read Only.

Thank you,

Steven


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Open file ready only

Workbooks.Open "xxxxxxx.xls", ReadOnly:=True

replace the xxxxx with your filename.

dmoney

"Steven" wrote:

I have code that on the Auto_Open it will run test to see if the file is read
only and if not then will make it ready only. The issue is that when you go
to ready only it will ask if you want to save the file. I do not because I
want the file only ready only from the beginning. What I did is make a
second file and on the Before_Save I test the name of the file and if it is
the name of the final file I am using I Cancel the Save. So I complete my
setup file and then I go to windows and make a copy and name it my final
file. So basically the user enters the file....in the Auto_Open it sets
DisplayAlerts to False ... then changes file to ready only ... the file wants
to save and since it is now the name of the file that I am testing and
Cancelling in the Before_Save it will not save and will switch to ReadOnly
with out saving and without displaying alerts. I also have cancelled out the
SaveAs..

Is this the best way to handle this or is there a way to tell a file to open
directly ReadOnly.

Note: I do not want to do Recommend Read Only. I want the file to open
and be forced to Read Only.

Thank you,

Steven


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Open file ready only

There is a little more to this one. This is a file that is being opened from
a Menu Command Button. Therefore the file is going to open when the Menu
Command Button runs the assigned macro ... and then I have to change it to
ReadOnly when the file is opened, unless there is a better way to tell a file
always open ready only. I am thinking logically it is a situation where
after the file is opened by clicking the Menu Command Button and running the
assigned macro that you have to set the file to ReadOnly as the first line in
the code of the assigned macro. It should switch to ReadOnly in less that a
second I would think and there is not much of a chance that another person
will be opening the file exactly at the same time and when the next user
opens the file it will already be ReadOnly on the previous user so the next
user will not get a message and also the first line of code will force the
second users access to ReadOnly also, and so on.....

What this is is a file that opens other xl files that have passwords and by
using this method I force the user to have macros enabled because the xl
files with the passwords run off macros and I do not want a user to bypass
the macros using macro security. Therefore they can open the file using the
master access file which is the file that has the Menu Command Button with
the assigned macro to the master access file ... or they could go direclty to
the file to open ... but since it is passworded they will not be able to
enter and therefore they can only enter the file with macros enabled.

"dmoney" wrote:

Workbooks.Open "xxxxxxx.xls", ReadOnly:=True

replace the xxxxx with your filename.

dmoney

"Steven" wrote:

I have code that on the Auto_Open it will run test to see if the file is read
only and if not then will make it ready only. The issue is that when you go
to ready only it will ask if you want to save the file. I do not because I
want the file only ready only from the beginning. What I did is make a
second file and on the Before_Save I test the name of the file and if it is
the name of the final file I am using I Cancel the Save. So I complete my
setup file and then I go to windows and make a copy and name it my final
file. So basically the user enters the file....in the Auto_Open it sets
DisplayAlerts to False ... then changes file to ready only ... the file wants
to save and since it is now the name of the file that I am testing and
Cancelling in the Before_Save it will not save and will switch to ReadOnly
with out saving and without displaying alerts. I also have cancelled out the
SaveAs..

Is this the best way to handle this or is there a way to tell a file to open
directly ReadOnly.

Note: I do not want to do Recommend Read Only. I want the file to open
and be forced to Read Only.

Thank you,

Steven


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel says ready but blue Blank Screen stays on and file doesn't o Three Spreadsheets To The Wind Excel Discussion (Misc queries) 1 May 24th 07 02:35 PM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
Open a file do a macro ( made) and open next succesive file SVTman74 Excel Programming 5 April 21st 06 10:14 PM
Open File or Switch Between Windows if File is Open Ricky Pang Excel Programming 2 July 8th 05 05:51 AM
Open File or Switch Between Windows if File is Open Ricky Pang Excel Programming 0 July 2nd 05 08:41 PM


All times are GMT +1. The time now is 09:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"