?
Solved

Aligning text in a message box

Posted on 2003-03-29
7
Medium Priority
?
257 Views
Last Modified: 2012-05-04
Hi all,

I am currently doing a car rental program in Excel, however I am altering my macros in VB. I have finally learned to extract characters from cells and place them in message boxes (w00t) however i now need to align them in order to make it look more presnetable.

My thanks to all comments

David
0
Comment
Question by:Helix
[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
7 Comments
 
LVL 3

Expert Comment

by:DeAn
ID: 8231852
I'm not sure what you mean.  did you mean textboxes? do you want to align the text or the box?
0
 
LVL 4

Expert Comment

by:SSSoftware
ID: 8231945
If you are using the MSGBOX function then I don't know of a way to align the text other than Left justify.

That is done by using the constant VBCRLF (Carrage return line feed or VBCR (Carrage return) in front of each line you want to left justify

If you need more control then you need to create a form

Then all things are possible.


Good Luck,
Ed
0
 

Author Comment

by:Helix
ID: 8232216
right, i found this:

quote:
--------------------------------------------------------------------------------
VB Ref again:
Settings
The buttons argument settings are:
Constant Value Description

vbOKOnly 0 Display OK button only.
vbOKCancel 1 Display OK and Cancel buttons.
vbAbortRetryIgnore 2 Display Abort, Retry, and Ignore buttons.
vbYesNoCancel 3 Display Yes, No, and Cancel buttons.
...
vbMsgBoxRight 524288 Text is right aligned
vbMsgBoxRtlReading 1048576 Specifies text should appear as right-to-left reading on Hebrew and Arabic systems

--------------------------------------------------------------------------------

However i'm not sure how to impliment this, would any of you guys mind having a go at this?
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 6

Accepted Solution

by:
GPrentice00 earned 200 total points
ID: 8232716
You pass an OR list of the vbconstants to get different message boxes, just OR the constant for right justify with the other constants to get the different boxes and styles.

Msgbox "Standard text message", vbOKOnly, "Standard form name"

-standard message form.  can even drop the vbokayonly, as its the default constant (0).

To combine style constants:

MsgBox "Hello?", vbExclamation Or vbYesNoCancel Or vbMsgBoxRight, "Right-justified Hello"

makes a form with y/n/c buttons, an exclamation and has the hello text right-justified.

IntegerVariable = msgbox ("Hello",vbYesNoCancel, "Pick one")
will let you determine which button was clicked, of course.

---
This is VB6, sorry if you're looking for something specific to VBA I think its a bit different, but the same principle applies: if you find a sytle constant for it, just OR it into the second parameter.  (Some people add the constants, as they are bit-sets and adding has the same effect as ORing, and may look more logical to a human reader later)
0
 

Expert Comment

by:CleanupPing
ID: 8531349
Hi Helix,
This old question (QID 20567619) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9440697
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Accept GPrentice00's comment as Answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9440698
I hate doing that
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

752 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