![]() |
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. |
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 |
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. |
All times are GMT +1. The time now is 08:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com