Right-align info in a MsgBox?
Author |
Message |
Mark Tangar #1 / 7
|
 Right-align info in a MsgBox?
Is there any way at all to place material against a right-aligned tab in a MsgBox. A vbTab works fine for left-aligning, but I'd like to produce something like the following (read this in a fixed-pitch font) in a MsgBox: Zeeps 977 Zoops 29 Total 1,006 I know I could probably devise a (monstrously complex) userform with two adjacent labels, one of them with TextAlign set to right. I'd like to avoid that. Any ideas? --
"Life is nothing if you're not obsessed." --John Waters
|
Tue, 30 Nov 2004 04:35:55 GMT |
|
 |
Dave Let #2 / 7
|
 Right-align info in a MsgBox?
Hi Mark, MsgBox "Zeeps 977" & vbCrLf & _ "Zoops 29" & vbCrLf & _ "Total 1006", vbMsgBoxRight But I noticed that you cannot use vbTab to help with the alignment as you might expect. You'd have to use hard spaces. HTH
Quote: > Is there any way at all to place material against a right-aligned tab > in a MsgBox. A vbTab works fine for left-aligning, but I'd like to > produce something like the following (read this in a fixed-pitch font) > in a MsgBox: > Zeeps 977 > Zoops 29 > Total 1,006 > I know I could probably devise a (monstrously complex) userform with > two adjacent labels, one of them with TextAlign set to right. I'd > like to avoid that. Any ideas? > --
> "Life is nothing if you're not obsessed." --John Waters
|
Tue, 30 Nov 2004 04:57:24 GMT |
|
 |
Mark Tangar #3 / 7
|
 Right-align info in a MsgBox?
Ah. OK, then since I can't tell what font the user may have set in Display Properties, I can't really do this so it'll always come out right. Correct? Mark Quote:
> Hi Mark, > MsgBox "Zeeps 977" & vbCrLf & _ > "Zoops 29" & vbCrLf & _ > "Total 1006", vbMsgBoxRight > But I noticed that you cannot use vbTab to help with the alignment as you > might expect. You'd have to use hard spaces. > HTH
> > Is there any way at all to place material against a right-aligned tab > > in a MsgBox. A vbTab works fine for left-aligning, but I'd like to > > produce something like the following (read this in a fixed-pitch font) > > in a MsgBox: > > Zeeps 977 > > Zoops 29 > > Total 1,006 > > I know I could probably devise a (monstrously complex) userform with > > two adjacent labels, one of them with TextAlign set to right. I'd > > like to avoid that. Any ideas? > > --
> > "Life is nothing if you're not obsessed." --John Waters
|
Tue, 30 Nov 2004 05:23:05 GMT |
|
 |
Modiglian #4 / 7
|
 Right-align info in a MsgBox?
Instead of a monstrously complex UserForm, why not create a simple one? Two adjacent labels is hardly brain-stretching.
Quote: > Is there any way at all to place material against a right-aligned tab > in a MsgBox. A vbTab works fine for left-aligning, but I'd like to > produce something like the following (read this in a fixed-pitch font) > in a MsgBox: > Zeeps 977 > Zoops 29 > Total 1,006 > I know I could probably devise a (monstrously complex) userform with > two adjacent labels, one of them with TextAlign set to right. I'd > like to avoid that. Any ideas? > --
> "Life is nothing if you're not obsessed." --John Waters
|
Tue, 30 Nov 2004 05:59:06 GMT |
|
 |
Mark Tangar #5 / 7
|
 Right-align info in a MsgBox?
I meant relatively monstrous (should've said heavy instead of complex), since it would add quite a chunk of bulk to its now-small template. Quote:
> Instead of a monstrously complex UserForm, why not create a simple one? Two > adjacent labels is hardly brain-stretching.
> > Is there any way at all to place material against a right-aligned tab > > in a MsgBox. A vbTab works fine for left-aligning, but I'd like to > > produce something like the following (read this in a fixed-pitch font) > > in a MsgBox: > > Zeeps 977 > > Zoops 29 > > Total 1,006 > > I know I could probably devise a (monstrously complex) userform with > > two adjacent labels, one of them with TextAlign set to right. I'd > > like to avoid that. Any ideas? > > --
> > "Life is nothing if you're not obsessed." --John Waters
|
Tue, 30 Nov 2004 07:43:49 GMT |
|
 |
Peter Dane #6 / 7
|
 Right-align info in a MsgBox?
You can specify the font for a label. If you use a fixed-pitch font, like FixedSys, you can convert your numbers to strings, check the length and insert the proper number of spaces to align everything. I did that in an Excel UserForm last fall, for exactly the same sort of thing you're doing. It looked really sharp, except for some reason which I never figured out, the Label would not always use the font I'd prescribed. But when it did, it looked great. -- Pete This e-mail address is fake to keep spammers and their auto-harvesters out of my hair. If you need to get in touch personally, I am 'pdanes' and I use Yahoo mail. But please use the newsgroups whenever possible, so that all may benefit from the exchange of ideas.
Quote: > Is there any way at all to place material against a right-aligned tab > in a MsgBox. A vbTab works fine for left-aligning, but I'd like to > produce something like the following (read this in a fixed-pitch font) > in a MsgBox: > Zeeps 977 > Zoops 29 > Total 1,006 > I know I could probably devise a (monstrously complex) userform with > two adjacent labels, one of them with TextAlign set to right. I'd > like to avoid that. Any ideas? > --
> "Life is nothing if you're not obsessed." --John Waters
|
Tue, 30 Nov 2004 16:18:25 GMT |
|
 |
Mark Tangar #7 / 7
|
 Right-align info in a MsgBox?
Thanks, I'll give that a try. BTW, I understand the inconsistent font appearance -- a maddening thing, to be sure -- can be caused by trying to tweak a control's size and position too finely. If you use only the mouse to size & position a control (including labels) the fonts stay as intended. If you use the Properties window to adjust size & position, the fonts can go AWOL as you've seen, UNLESS you keep the size/position measurements to multiples of X, where X is the grid unit setting in the VB editor under Tools-> Options-> General (default is 6 but you can use as low as 3; I do). So, for example, a label, textbox, etc. with a Top property of 15, Left of 12, Height of 18, and Width of 39 always plays nice with the fonts, but if I adjust any of these measurements away from a multiple of 3, sooner or later things go south. HTH. --
"Life is nothing if you're not obsessed." --John Waters Quote:
> You can specify the font for a label. If you use a fixed-pitch font, like > FixedSys, you can convert your numbers to strings, check the length and > insert the proper number of spaces to align everything. I did that in an > Excel UserForm last fall, for exactly the same sort of thing you're doing. > It looked really sharp, except for some reason which I never figured out, > the Label would not always use the font I'd prescribed. But when it did, it > looked great. > -- > Pete > This e-mail address is fake to keep spammers and their auto-harvesters out > of my hair. If you need to get in touch personally, I am 'pdanes' and I use > Yahoo mail. But please use the newsgroups whenever possible, so that all may > benefit from the exchange of ideas.
> > Is there any way at all to place material against a right-aligned tab > > in a MsgBox. A vbTab works fine for left-aligning, but I'd like to > > produce something like the following (read this in a fixed-pitch font) > > in a MsgBox: > > Zeeps 977 > > Zoops 29 > > Total 1,006 > > I know I could probably devise a (monstrously complex) userform with > > two adjacent labels, one of them with TextAlign set to right. I'd > > like to avoid that. Any ideas? > > --
> > "Life is nothing if you're not obsessed." --John Waters
|
Wed, 01 Dec 2004 05:09:01 GMT |
|
|
|