Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Read Only Enforcement

Is there a way in a macro to force read only?

I see that you can set readonlyRecommended=True.

However, when my users open up the file, they still have the ability t
open it as normal if they select it with the warning.

What I want to do if force my file to save in readonly and not let the
open it any other way.

Is there a way to do this when saving the file in the macro before
give it to my staff

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Read Only Enforcement

Try setting the file attribute to read-only, this way
Excel will open as read-only without asking.
This is an operating system level attribute so potentially
could be changed outside of Excel.

In VBA use......
SetAttr "file", vbReadOnly

Since you presumably do not want your staff to change the
contents you might want to prevent "saving" this file as
well by disabling the save menu options.

-----Original Message-----
Is there a way in a macro to force read only?

I see that you can set readonlyRecommended=True.

However, when my users open up the file, they still have

the ability to
open it as normal if they select it with the warning.

What I want to do if force my file to save in readonly

and not let them
open it any other way.

Is there a way to do this when saving the file in the

macro before I
give it to my staff?


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Read Only Enforcement

I think you have to set the password on the options when
you first save the file (keep the password simple, and
keep a record somewhere)

-----Original Message-----
Is there a way in a macro to force read only?

I see that you can set readonlyRecommended=True.

However, when my users open up the file, they still have

the ability to
open it as normal if they select it with the warning.

What I want to do if force my file to save in readonly

and not let them
open it any other way.

Is there a way to do this when saving the file in the

macro before I
give it to my staff?


---
Message posted from http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Read Only Enforcement

Application.DisplayAlerts = False
ThisWorkbook.SaveAs ThisWorkbook.FullName, , , "sesame"
Application.DisplayAlerts = True

should do it.

The user would need the password ("sesame") to override the read-only
requirement.

--

Vasant

"andycharger " wrote in message
...
Is there a way in a macro to force read only?

I see that you can set readonlyRecommended=True.

However, when my users open up the file, they still have the ability to
open it as normal if they select it with the warning.

What I want to do if force my file to save in readonly and not let them
open it any other way.

Is there a way to do this when saving the file in the macro before I
give it to my staff?


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Read Only Enforcement

Can you tell me how I disable the Save option in the menu then?
I need to do this either before or during the save of the document
Obviously I dont want to make it part of a macro that runs when a use
opens the file as they can choose to disable macros!

Also you mention the set attr function. Where do I set it and what do
type?


Any ideas

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Read Only Enforcement

Andy,
The workbook has a _BeforeSave event, with a Cancel parameter.
That might do the trick.

Password protect the VBA code also, so it cannot be bypassed.

Anyone can still Copy the sheet to a new workbook though, by right clicking
on the sheet tab, so you would need to Hide sheet tabs form the Options and
protect the worksheet also.

NickHK

"andycharger " wrote in message
...
Can you tell me how I disable the Save option in the menu then?
I need to do this either before or during the save of the document.
Obviously I dont want to make it part of a macro that runs when a user
opens the file as they can choose to disable macros!

Also you mention the set attr function. Where do I set it and what do I
type?


Any ideas?


---
Message posted from http://www.ExcelForum.com/



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
Read only file is NOT Read only Marilyn Excel Discussion (Misc queries) 1 November 18th 08 05:22 AM
I have a read only xl file, I need it to be read and write drama queen Excel Discussion (Misc queries) 3 July 1st 06 12:25 AM
Read-write/Read-only Jillian Excel Discussion (Misc queries) 4 February 16th 06 05:26 PM
XCEL FILE REC'D AS READ ONLY -- HOW TO NOT BE "READ ONLY" billybob Excel Discussion (Misc queries) 1 February 13th 06 03:14 AM
How can a file be converted from Read-Only to Read/Write Jim in Apopka Excel Discussion (Misc queries) 2 November 19th 05 04:59 PM


All times are GMT +1. The time now is 03:53 PM.

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

About Us

"It's about Microsoft Excel"