Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 'Yes' 'No' button on autoopen macro

I have an autoopen MsgBox macro created. Instead of the "OK" button, I want the user to choose between "Yes" and "No" buttons. Yes=a pathway to a designated network drive and folder, No=remain on current worksheet. Q1. Syntax to instruct Excel to include Yes and No buttons in the MsgBox prompt. Q2. Syntax to instruct Excel what to do when either button is clicked. Thank you for any help you may offer. Your expertise is greatly appreciated

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 'Yes' 'No' button on autoopen macro

rc = MsgBox ("Hello",vbYesNo

if the user selects Yes, rc =
if the user selcts No, rc = 7
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default 'Yes' 'No' button on autoopen macro

Larry,

Try this code:

'''''''''''''''''''
Dim ans As String
'
ans = MsgBox("Do you want to stay in this workbook?", vbYesNo)
If ans = 6 Then
MsgBox ("You have chosen to stay in this workbook")
ElseIf ans = 7 Then
MsgBox ("You have chosen to do something else")
Else
MsgBox ("You didn't make a choice")
End If
''''''''''''''''''''''''''''

hth
--

steveB

(Remove 'NOSPAM' from email address if contacting me direct)


"Larry" wrote in message
...
I have an autoopen MsgBox macro created. Instead of the "OK" button, I

want the user to choose between "Yes" and "No" buttons. Yes=a pathway to a
designated network drive and folder, No=remain on current worksheet. Q1.
Syntax to instruct Excel to include Yes and No buttons in the MsgBox prompt.
Q2. Syntax to instruct Excel what to do when either button is clicked.
Thank you for any help you may offer. Your expertise is greatly
appreciated.



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
Counting 'Yes' or 'No' slavenp Excel Discussion (Misc queries) 5 November 12th 08 11:13 AM
How to do: If 'yes', then show extra columns mgirving Excel Discussion (Misc queries) 1 September 2nd 06 01:36 PM
How to end macro on inital active worksheet containing macro button that was clicked Silverhawk1 Excel Programming 2 May 14th 04 03:58 PM
Creating 'yes' or 'no' option in a designated cell ian123[_29_] Excel Programming 2 December 28th 03 03:32 PM
Disable AutoOpen macro's Michael Beckinsale Excel Programming 1 October 16th 03 01:48 PM


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