#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default MsgBox Help


How can I program a MsgBox to pop up every time the program is opened?
want 2 to have 2 buttons, "yes" and "no". Yes lets you access th
spreadsheet, clicking no will not let you access the sheet. Thanks fo
your help!

Zac

--
Zach
-----------------------------------------------------------------------
Zach H's Profile: http://www.excelforum.com/member.php...fo&userid=3188
View this thread: http://www.excelforum.com/showthread.php?threadid=51616

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default MsgBox Help


Code
-------------------
Private Sub Workbook_Open()
msg = MsgBox("Access the Spreadsheet?", vbYesNo)
If msg = vbYes Then
Sheets("Sheet1").Activate
else
' closes the active workbook without saving any changes
ActiveWorkbook.Close False
end if
End Sub

-------------------

--
gti_jober
-----------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...fo&userid=3063
View this thread: http://www.excelforum.com/showthread.php?threadid=51616

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default MsgBox Help

Private Sub Workbook_Open()
If MsgBox("Yes or No ", vbYesNo) = vbYes Then
'do something
End If

End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Zach H" wrote in
message ...

How can I program a MsgBox to pop up every time the program is opened? I
want 2 to have 2 buttons, "yes" and "no". Yes lets you access the
spreadsheet, clicking no will not let you access the sheet. Thanks for
your help!

Zach


--
Zach H
------------------------------------------------------------------------
Zach H's Profile:

http://www.excelforum.com/member.php...o&userid=31888
View this thread: http://www.excelforum.com/showthread...hreadid=516160



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default MsgBox Help


Worked like a charm! Thanks!!


--
Zach H
------------------------------------------------------------------------
Zach H's Profile: http://www.excelforum.com/member.php...o&userid=31888
View this thread: http://www.excelforum.com/showthread...hreadid=516160

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
msgbox scottnshelly[_29_] Excel Programming 1 April 29th 04 07:47 AM
MsgBox shasta[_5_] Excel Programming 4 April 13th 04 01:56 PM
Msgbox help JonoB Excel Programming 2 October 27th 03 03:06 PM
Msgbox Bernd[_2_] Excel Programming 0 October 24th 03 10:20 AM
MsgBox Phil Perry Excel Programming 1 July 9th 03 07:38 PM


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