LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Command button and msgbox's

You could add code to the button to check (don't disable it).

if whateveryoucheckedtodetermineowner = false then
msgbox "You're not an owner"
exit sub
end if

'your real code here.

If IsError(Application.Match _
(Application.UserName, Worksheets("Hiddennamehere").Range("a:a"), 0)) Then
MsgBox "You're not an owner"
Exit Sub
End If

Candee wrote:

Hello everyone.

I have a worksheet that opens a simple userform when the file is opened
with 2 command buttons (bOwner and bUser). It checks to see who has
opened the file (Application.UserName), looks up the persons ID in a
list to determine if they are an owner or a user of the file. If the
person is not an owner, then the Owner button is disabled
(bOwner.Enabled = False). Each button has vba attached to hide or show
certain sheets in the file. I have disabled the "X" This part works
fine.

My question is, there are some people that will try to click the
"Owner" button even though it has been disabled. Can I have a message
box appear that tells them they have to choose the other button (even
though this one is disabled)?

TIA

Candee

--
Candee
------------------------------------------------------------------------
Candee's Profile: http://www.excelforum.com/member.php...nfo&userid=638
View this thread: http://www.excelforum.com/showthread...hreadid=483581


--

Dave Peterson
 
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
command button sub Atishoo Excel Discussion (Misc queries) 3 February 11th 09 04:50 PM
command button add another command Wanna Learn Excel Discussion (Misc queries) 5 December 7th 08 11:42 PM
command button abfabrob Excel Discussion (Misc queries) 5 October 7th 05 12:54 AM
Command Button vs Control Button RGibson Excel Programming 1 October 14th 03 02:24 AM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


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