Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie MsgBox question

Status
Not open for further replies.

Quintios

Technical User
Mar 7, 2002
482
US
How do I get text to center in a message box? I apologize for this really stupid question, but I can't seem to find an answer anywhere, and I know there *has* to be a way to do this.

Here's the box in question:

MsgBox "This action will delete the record" & CHR$(13) & _
CHR$(13) & CHR$(10) & "This action cannot be _
undone.", vbOkOnly, "WARNING!!"

Thanks.
Onwards,

Q-
 
Sorry.....there is no way....not with msgbox....

You'll need to create a form as a custom dialog.

Craig
 
Actually I found a way, you use the VBA command 'String' to add extra spaces to move things over. A bit of trial and error, but it works. So it's not centered in the traditional sense, but it'll work.

Thanks for the feedback!


Onwards,

Q-
 
The only way I have found is to enter spaces between the first quote and the first character of your text. It takes a little time to figure out exactly how many spaces, but you catch on fairly quick after you have done a few. This will work with your code, but it will not be effective with any dynamicly changing text.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top