Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to open a workbook as read only

I'm using Excel 2007 and need a private macro that will make the workbook
read only when opening. I've found some code which is along the lines of
workbook.open filename etc etc readonly

First off I cant get it to work and secondly the workbook will potentially
be saved into numerous locations so dont want to keep editing macros.

My best solution is the code that changes the file access to readonly
running as a private macro on worksheet open (ActiveWorkbook.ChangeFileAccess
xlReadOnly). But now I get a pop up message saying "Do you want to save
changes before switching file status?". I want some code that will say "Yes"
without prompting the user. I've tried switching off the prompts (
Application.DisplayAlerts = False) but that doesn't work.

Help.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Macro to open a workbook as read only

Look at GetOpenFileName in VBA help for a browser technique to g get the
file.


---
HTH

Bob Phillips

"Sliders919" wrote in message
...
I'm using Excel 2007 and need a private macro that will make the workbook
read only when opening. I've found some code which is along the lines of
workbook.open filename etc etc readonly

First off I cant get it to work and secondly the workbook will potentially
be saved into numerous locations so dont want to keep editing macros.

My best solution is the code that changes the file access to readonly
running as a private macro on worksheet open
(ActiveWorkbook.ChangeFileAccess
xlReadOnly). But now I get a pop up message saying "Do you want to save
changes before switching file status?". I want some code that will say
"Yes"
without prompting the user. I've tried switching off the prompts (
Application.DisplayAlerts = False) but that doesn't work.

Help.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Macro to open a workbook as read only

Why don't you just protect the workbook with a password and Excel will prompt
the user for the password or force them to click Read Only. This will open
your workbook as read-only.

Open your workbook, click Save As, then click ToolsGeneral Options. You
then can set passwords.

Hope this helps! If so, click 'YES' below.
--
Cheers,
Ryan


"Sliders919" wrote:

I'm using Excel 2007 and need a private macro that will make the workbook
read only when opening. I've found some code which is along the lines of
workbook.open filename etc etc readonly

First off I cant get it to work and secondly the workbook will potentially
be saved into numerous locations so dont want to keep editing macros.

My best solution is the code that changes the file access to readonly
running as a private macro on worksheet open (ActiveWorkbook.ChangeFileAccess
xlReadOnly). But now I get a pop up message saying "Do you want to save
changes before switching file status?". I want some code that will say "Yes"
without prompting the user. I've tried switching off the prompts (
Application.DisplayAlerts = False) but that doesn't work.

Help.


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 Message for open workbook Les Excel Programming 1 March 17th 08 07:42 PM
Running a macro in a open as read-o Workbook TBarreiro Excel Programming 0 September 2nd 05 04:06 PM
Running a macro in a open as read-o Workbook TBarreiro Excel Programming 0 September 2nd 05 04:02 PM
Running a macro in a open as read-o Workbook TBarreiro Excel Programming 0 September 2nd 05 03:55 PM
workbook open read only without prompt turbogoat Excel Programming 1 August 26th 04 10:44 PM


All times are GMT +1. The time now is 07:58 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"