Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Use file-status in IF ... THEN

I have an Excel-file on a p2p network.
It has a password so that most network-users can open it for reading and
only some are able to change it (after they have entered the password).

*** I would like to make certain buttons available only when opened by the
latter and not available when opened "read-only". ***
Any ideas are welcome!

The password is added the "normal" way (Save As + Extra and enter the
password), so it is not programmed in some VBA routine or so (don't even
know if this can be done and this isn't my question either).

Jan V.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Use file-status in IF ... THEN

Assume you have 3 buttons placed on the worksheet "Sheet1"
The names of the 3 buttons a "Button 1", "Button 2", "Button 3

Place the following macro into the "Thisworkbook" of the Excel file
If the file is opened as read only, the buttons will not be displayed; vice versa

'-----------------------------------------------------------------
Private Sub Workbook_Open(
Dim tmp As Boolea
tmp = Not ThisWorkbook.ReadOnl
With ThisWorkbook.Worksheets("Sheet1"
.DrawingObjects(Array("Button 1", "Button 2", "Button 3")).Visible = tm
End Wit
End Su
'-----------------------------------------------------------------

Regards
Edwin Ta

http://www.vonixx.co


----- Jan V. wrote: ----

I have an Excel-file on a p2p network
It has a password so that most network-users can open it for reading an
only some are able to change it (after they have entered the password)

*** I would like to make certain buttons available only when opened by th
latter and not available when opened "read-only". **
Any ideas are welcome

The password is added the "normal" way (Save As + Extra and enter th
password), so it is not programmed in some VBA routine or so (don't eve
know if this can be done and this isn't my question either)

Jan V

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Use file-status in IF ... THEN

Jan,

Workbooks have a ReadOn ly property that you can test

If ActiveWorkbook.ReadOnly Then
ActiveWorkbook.SaveAs fileName:="NEWFILE.XLS"
End If-- HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jan V." wrote in message
...
I have an Excel-file on a p2p network.
It has a password so that most network-users can open it for reading and
only some are able to change it (after they have entered the password).

*** I would like to make certain buttons available only when opened by the
latter and not available when opened "read-only". ***
Any ideas are welcome!

The password is added the "normal" way (Save As + Extra and enter the
password), so it is not programmed in some VBA routine or so (don't even
know if this can be done and this isn't my question either).

Jan V.




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
How can I toggle in and out of read-only status in an Excel file? SS Excel Discussion (Misc queries) 3 April 11th 09 04:50 PM
How do I clear read-only status on a workbook file? Karin Excel Discussion (Misc queries) 1 March 2nd 07 04:55 PM
How to hide Sheet tab Bar & status Bar for a excel file Vikky Excel Worksheet Functions 3 July 17th 06 09:31 AM
How do I print the read-only status of Excel file? Kyla Excel Discussion (Misc queries) 0 October 18th 05 06:51 PM
File Read-Only Status Nigel[_5_] Excel Programming 3 November 5th 03 05:38 PM


All times are GMT +1. The time now is 04:43 AM.

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"