?
Solved

Macro Code Revision - Types of Warning Messages?

Posted on 2013-01-20
14
Medium Priority
?
277 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

649 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