• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

Aligning text in a message box

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
Helix
Asked:
Helix
1 Solution
 
DeAnCommented:
I'm not sure what you mean.  did you mean textboxes? do you want to align the text or the box?
0
 
SSSoftwareCommented:
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
 
HelixAuthor Commented:
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
Technology Partners: 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!

 
GPrentice00Commented:
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
 
CleanupPingCommented:
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
 
GPrentice00Commented:
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
 
GPrentice00Commented:
I hate doing that
0

Featured Post

Technology Partners: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now