Solved

Visio 2013 VBA - Message Box Questions

Posted on 2014-01-28
2
719 Views
Last Modified: 2014-02-02
Here is the message box I'm creating:
MsgBox "DOUBLE-CLICK a desired city to view its detailed diagram." & vbCrLf & vbCrLf& "Press ALT + left arrow", , "some company name"

Open in new window


There are two things I'm having aproblem with:
1.  I want to have TWO blank lines inbetween my first text message and my second message.  Is there a more compact way to ask for Two VBCRLF?
2.  I would like to insert a graphic for the left arrow symbol rather than the words "left arrow"  ¿  For some reason I can't even show the left pointing arrow here!  It shows up as an upside down question mark.
0
Comment
Question by:brothertruffle880
2 Comments
 
LVL 4

Assisted Solution

by:ravikantninave
ravikantninave earned 250 total points
ID: 39815857
1]  I didn't find any alternate for vbcrlf.  
2] To show Left arrow the least solution is to use chr(62).  Check the example.
MsgBox "DOUBLE-CLICK a desired city to view its detailed diagram." & vbNewLine & vbCrLf & "Press ALT + left arrow -" + Chr(62), , "some company name"

Open in new window


Hope it helps you.
0
 
LVL 30

Accepted Solution

by:
Scott Helmers earned 250 total points
ID: 39817652
The standard set of printable ASCII characters, which you can use easily in VBA, does not include a true left arrow so your use of "Press ALT + left arrow" may be the best alternative.

[NOTE: ravikantninave's suggestion of using chr(62) should probably be chr(60) because chr(60) is the left-pointing "less than" symbol.  Regardless, using those symbols will be misleading in your msgbox because the user will probably press the "<" key rather than the left arrow key.]

Re part 1 of your question about vbCrLf: one way to shorten your text string is simply to define a contstant that you can then use as shown below:
Const CrLf2 As String = vbCrLf & vbCrLf

MsgBox "first line of message" & CrLf2 & "second line of message"

Open in new window

One other style suggestion: if part of the problem is that your code is hard to read because the parameters for the msgbox statement continue off the screen to the right, you can use the underscore character to indicate that the command continues on the next line, e.g.,
MsgBox "DOUBLE-CLICK a desired city to view its detailed diagram." & _
       vbCrLf & vbCrLf & "Press ALT + left arrow", , _
       "some company name"

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now