Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default MSG BOX through macro


I would like to setup the macro to confirm they want the macro to b
performed. Can someone please help with this

The macro will be assigned to a push button on the worksheet, once th
report is complete they push the button and then i want it to create
pop up asking "do you wish to close this report YES/NO"
if yes then peform close, if not do nothing.

thank

--
XCESI
-----------------------------------------------------------------------
XCESIV's Profile: http://www.excelforum.com/member.php...fo&userid=2427
View this thread: http://www.excelforum.com/showthread.php?threadid=53847

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default MSG BOX through macro

Answer = MsgBox("Would You Like To Close The Workbook?", vbYesNo)
If Answer = vbYes Then
ActiveWorkbook.Save
ActiveWorkbook.Close
Else:
Cells.Select


"XCESIV" wrote in
message ...

I would like to setup the macro to confirm they want the macro to be
performed. Can someone please help with this

The macro will be assigned to a push button on the worksheet, once the
report is complete they push the button and then i want it to create a
pop up asking "do you wish to close this report YES/NO"
if yes then peform close, if not do nothing.

thanks


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile:
http://www.excelforum.com/member.php...o&userid=24271
View this thread: http://www.excelforum.com/showthread...hreadid=538473



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default MSG BOX through macro

Try something like

Dim Res As VbMsgBoxResult
Res = MsgBox("Do you want to close this report?", vbYesNo)
If Res = vbYes Then
' do something
Else
' do nothing
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"XCESIV"
wrote in message
...

I would like to setup the macro to confirm they want the macro
to be
performed. Can someone please help with this

The macro will be assigned to a push button on the worksheet,
once the
report is complete they push the button and then i want it to
create a
pop up asking "do you wish to close this report YES/NO"
if yes then peform close, if not do nothing.

thanks


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile:
http://www.excelforum.com/member.php...o&userid=24271
View this thread:
http://www.excelforum.com/showthread...hreadid=538473



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default MSG BOX through macro

XCESIV, here is a general macro that shows a message box with yes, no, and
cancel options, just change to fit your needs

Sub Message_box_test()
Dim Msg, Title, Response As String
Msg = "Put message here"
Title = "Put title here"
Response = MsgBox(Msg, vbYesNoCancel + vbQuestion, Title)

If Response = vbNo Then
'your code if no is clicked here
MsgBox "you clicked no"
Exit Sub ' Quit the macro
End If

If Response = vbCancel Then
'your code if Cancel is clicked here
MsgBox "You clicked cancelled"
Exit Sub ' Quit the macro
End If

'your code if Yes is clicked here
MsgBox "you clicked yes"
End Sub

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"XCESIV" wrote in
message ...

I would like to setup the macro to confirm they want the macro to be
performed. Can someone please help with this

The macro will be assigned to a push button on the worksheet, once the
report is complete they push the button and then i want it to create a
pop up asking "do you wish to close this report YES/NO"
if yes then peform close, if not do nothing.

thanks


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile:
http://www.excelforum.com/member.php...o&userid=24271
View this thread: http://www.excelforum.com/showthread...hreadid=538473



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default MSG BOX through macro

Sub myMacro()
Dim ans As Long
ans = MsgBox("Continue?",vbYesNo)
If ans = vbNo Then Exit Sub
' rest of code
End Sub

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"XCESIV" wrote in
message ...

I would like to setup the macro to confirm they want the macro to be
performed. Can someone please help with this

The macro will be assigned to a push button on the worksheet, once the
report is complete they push the button and then i want it to create a
pop up asking "do you wish to close this report YES/NO"
if yes then peform close, if not do nothing.

thanks


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile:

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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default MSG BOX through macro

You could adapt this

Select Case MsgBox("cntr=" & RecentCntr & " " _
& Application.RecentFiles(RecentCntr).Name _
& vbNewLine & "Delete?", vbYesNoCancel + vbDefaultButton2)
Case vbCancel
GoTo endpgm
Case vbYes
Application.RecentFiles(RecentCntr).Delete
MsgBox "File deleted from recent files list"
Case vbNo
' Do nothing
Case Else
' Do nothin
End Select


"XCESIV" wrote:


I would like to setup the macro to confirm they want the macro to be
performed. Can someone please help with this

The macro will be assigned to a push button on the worksheet, once the
report is complete they push the button and then i want it to create a
pop up asking "do you wish to close this report YES/NO"
if yes then peform close, if not do nothing.

thanks


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile: http://www.excelforum.com/member.php...o&userid=24271
View this thread: http://www.excelforum.com/showthread...hreadid=538473


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default MSG BOX through macro


sub example1

answer = msgbox ("Do you wish to close thi
report?",vbYesNo,Title:="Just to Confirm")

if answer=vbyes then activeworkbook.close

end su

--
funkymonkU
-----------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...fo&userid=1813
View this thread: http://www.excelforum.com/showthread.php?threadid=53847

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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 09:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"