View Full Version : msgbox help wanted
lior03
11-27-2007, 07:21 AM
hello all
i want to present several optios to a user .i want to have each option in a row.
Dim sheetpo As VbMsgBoxResult
sheetpo = MsgBox("this sheet is to be: & vbCrLf &1.duplicated after last sheet (press yes)& vbCrLf & 2.it may be deleted (press no) " _
, vbInformation + vbYesNoCancel, "sheet copy/delete")
Select Case sheetpo
Case vbYes
ActiveSheet.Copy Before:=Sheets(Sheets.Count)
Case vbNo
ActiveSheet.Delete
Application.DisplayAlerts = False
Case vbCancel
Exit Sub
End Select
thanks
Try this:
Dim sheetpo As VbMsgBoxResult
sheetpo = MsgBox("this sheet is to be: " & vbCrLf & _
"1.duplicated after last sheet (press yes)" & vbCrLf & _
"2.it may be deleted (press no) " _
, vbInformation + vbYesNoCancel, "sheet copy/delete")
Select Case sheetpo
Case vbYes
ActiveSheet.Copy Before:=Sheets(Sheets.Count)
Case vbNo
ActiveSheet.Delete
Application.DisplayAlerts = False
Case vbCancel
Exit Sub
End Select
Bob Phillips
11-27-2007, 07:50 AM
sheetpo = MsgBox("this sheet is to be:" & vbNewLine & _
"1.duplicated after last sheet (press yes)" & vbNewLine & _
"2.it may be deleted (press no) ", _
vbInformation + vbYesNoCancel, "sheet copy/delete")
apprently vbNewLine works with Macs so is more generic
Cyberdude
11-27-2007, 09:04 PM
For what it's worth, I've gotten in the habit of using a standard title in all macros that use Msgbox:
Constant Title As String = "'Workbkname' (macroname)'"
'. . .
Msgbox "My msg text", vbOKCancel, Title This can be quite useful when wondering where a particular message was issued.
RonMcK3
11-27-2007, 09:57 PM
For what it's worth, I've gotten in the habit of using a standard title in all macros that use Msgbox:
Constant Title As String = "'Workbkname' (macroname)'"
'. . .
Msgbox "My msg text", vbOKCancel, Title This can be quite useful when wondering where a particular message was issued.
Brilliant!
Wonderful suggestion.
Ron
Orlando, FL
asingh
11-28-2007, 03:00 AM
For what it's worth, I've gotten in the habit of using a standard title in all macros that use Msgbox:
[vba]Constant Title As String = "'Workbkname' (macroname)'"
'. . .
.
Is there anyway..that the Workbook name and Macroname..be assigned dynamically..stored in two variables..and the Title be 'built'....??
Instead of each time..hardcoding it in...?
regards,
asingh
Bob Phillips
11-28-2007, 05:46 AM
Workbook name is simple
myWb = Activeworkbook.Name
Macroname is not easy, ther is no object exposed.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.