Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to make a button conditional

I have a workbook with several sheets and buttons in them.
This excel-file is shared over a p2p network and is password protected
against writing.
The idea is, that everyone can consult the file but only some can change it.
For changing and for consulting some buttons were programmed. If someone
opens the file read-only and tries to make some change via the changing
buttons he or she seems to get away with this ... BUT, if the file is then
closed, several dialoge messages appear (telling that saving is not allowed
and asking if you want to save to a new file). To avoid this, I would like
to make functioning of the changing buttons conditional to the
writing-password. Hitting the changing buttons in read-only status (so
without using the password to open the file) can than result in a simple
message telling this operation is not allowed. This should be possible with
a IF ... THEN ... ELSE statement.

Only, how/where can I get this (status)information (so, whether the file was
or wasn't opened using the password that allows writing and changing) and
combine it with the code the button refers to?

Would appreciate any help on this.

Jan V.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default How to make a button conditional

Jan

What kind of buttons are they, Forms toolbar buttons or Control Toolbox
buttons. If the latter, you can put code like this in the open event.

Private Sub Workbook_Open()

Dim oleo As OLEObject

If Me.ReadOnly Then
For Each oleo In Me.Sheets(1).OLEObjects
oleo.Enabled = False
Next oleo
End If

End Sub


--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com



"Jan V." wrote in message
...
I have a workbook with several sheets and buttons in them.
This excel-file is shared over a p2p network and is password protected
against writing.
The idea is, that everyone can consult the file but only some can change

it.
For changing and for consulting some buttons were programmed. If someone
opens the file read-only and tries to make some change via the changing
buttons he or she seems to get away with this ... BUT, if the file is then
closed, several dialoge messages appear (telling that saving is not

allowed
and asking if you want to save to a new file). To avoid this, I would like
to make functioning of the changing buttons conditional to the
writing-password. Hitting the changing buttons in read-only status (so
without using the password to open the file) can than result in a simple
message telling this operation is not allowed. This should be possible

with
a IF ... THEN ... ELSE statement.

Only, how/where can I get this (status)information (so, whether the file

was
or wasn't opened using the password that allows writing and changing) and
combine it with the code the button refers to?

Would appreciate any help on this.

Jan V.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to make a button conditional

Jan,

I'm sorry, I don't have a reply to your question, but I am ver
interested in how you set up your p2p in Excel.

If you wouldn't mind sharing you code could you send me a copy to tak
a look at. If not, thank you anyway.

TIA



--
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
make a cell into a button RGlade Excel Discussion (Misc queries) 1 January 28th 08 07:35 PM
how to make search button in the first sheet ghost Excel Discussion (Misc queries) 0 July 28th 07 07:20 AM
How can I make a clickable button to do a Key Combo? BGerman Excel Worksheet Functions 4 August 21st 06 05:01 PM
Make a 'Print button' BrianT New Users to Excel 2 June 30th 06 09:57 PM
Make tools button grey losmac Excel Programming 0 August 25th 03 05:04 PM


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