?
Solved

Macro Code Revision - Types of Warning Messages?

Posted on 2013-01-20
14
Medium Priority
?
269 Views
Last Modified: 2013-01-26
Hello Experts,

I am currently using this code,...

Sub ClearMeasuringUp()
    If MsgBox("You are about to clear the entire worksheet - Are you sure you want to proceed?", vbYesNo) = vbYes Then
        ActiveSheet.Range("B28:D28,F28:H28,J28:L28,P28").ClearContents
        ActiveSheet.Range("N27").Value = "Diameter"
        Application.Goto Reference:="Diameter"
        Selection.ClearContents
    End If
End Sub

My question, is specific to this line of code...

    If MsgBox("You are about to clear the entire worksheet - Are you sure you want to proceed?", vbYesNo) = vbYes Then

Here is a screenshot of how the viewer sees it.

Warning Message
Now here's my question...

Are there other types of popup messages?  For example, as you can see my message is put into the body of the popup.  Is there a piece of code that controls the title of that window? Is there a piece of code that maybe shows a lil stop/warning/information icon?

Any ideas?

Thank you in advance for your help!

~ Geekamo
0
Comment
Question by:Geekamo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
  • +1
14 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38799199
If MsgBox("You are about to clear the entire worksheet - Are you sure you want to proceed?", vbYesNo,"Your warning title") = vbYes Then


I do not think you can put an icon in there.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38799201
For an icon you probably would have to revert to userforms
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 38799226
You do have some icon options.  For example:

' Question mark

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you want to proceed?", vbYesNo + vbQuestion, _
    "Your warning title") = vbYes Then

Open in new window


' Exclamation point

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you wait to proceed?", vbYesNo + Exclamation, _
    "Your warning title") = vbYes Then

Open in new window


' Error

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you want to proceed?", vbYesNo + Critical, _
    "Your warning title") = vbYes Then

Open in new window


' Information

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you want to proceed?", vbYesNo + vbInformation, _
    "Your warning title") = vbYes Then

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 49

Expert Comment

by:Martin Liss
ID: 38799244
There are several options you can use.
several
0
 
LVL 1

Author Comment

by:Geekamo
ID: 38799245
@ matthewspatrick,

I am using...

' Exclamation point

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you wait to proceed?", vbYesNo + Exclamation, _
    "Your warning title") = vbYes Then

But this is what it shows,...

Missing Icon
It doesn't include the exclamation point.

Any ideas?

~ Geekamo
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 38799253
try VBExclamation
0
 
LVL 1

Author Comment

by:Geekamo
ID: 38799259
@ MartinLiss,

I'm not sure what "try VBExclamation" means.
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 38799260
Yes this works fine.

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you wait to proceed?", vbYesNo + vbExclamation, _
    "Your warning title") = vbYes Then...
0
 
LVL 1

Author Comment

by:Geekamo
ID: 38799271
@ MartinLiss,

Your code,...

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you wait to proceed?", vbYesNo + vbExclamation, _
    "Your warning title") = vbYes Then

Results in this,...

Excel Icon
Clearly it's showing the excel icon, and not an exclamation icon.  I wonder if we're now getting into the area of me using Excel on Mac.  Is it different somehow?

The icon would be great, but it's not the end of the world.  If there isn't a easy fix, then I might just go with "ID: 38799199" because it at least gets me the title.

Anyhow, let me know your thoughts.

~ Geekamo
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 38799282
Well it's not that clear:)
FromVBAAre you using VBA in Excel 2010 for that message?
0
 
LVL 1

Author Comment

by:Geekamo
ID: 38799305
@ MartinLiss,

Excel Version
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 38799312
Oh, that's Excel for the MAC not for the PC, so, sorry, I can't help you.
0
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 total points
ID: 38799400
Geekamo,

Sorry, the code in my post should have been:

' Question mark

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you want to proceed?", vbYesNo + vbQuestion, _
    "Your warning title") = vbYes Then

Open in new window


' Exclamation point

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you wait to proceed?", vbYesNo + vbExclamation, _
    "Your warning title") = vbYes Then

Open in new window


' Error

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you want to proceed?", vbYesNo + vbCritical, _
    "Your warning title") = vbYes Then

Open in new window


' Information

If MsgBox("You are about to clear the entire worksheet - " & _
    "Are you sure you want to proceed?", vbYesNo + vbInformation, _
    "Your warning title") = vbYes Then

Open in new window

0
 
LVL 1

Author Comment

by:Geekamo
ID: 38823216
Thank you all! ~ Geekamo
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question