Right-align info in a MsgBox? 
Author Message
 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  
 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  
 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  
 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  
 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  
 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  
 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  
 
 [ 7 post ] 

 Relevant Pages 

1. Right aligned text boxes don't right align

2. left align and/or right align the masked edit control under VB 5.0 SP(3)

3. Aligning text Left or Mid in MsgBox function/action

4. msgbox align text and display for period of time

5. Right Align fields in a List

6. Howto right-align text

7. right-aligning numbers in listbox

8. Table Column Right Align

9. Making a Table Column Right Align

10. Reset position of right aligned tab in style definition

11. Center or right-align a userform caption?

12. Can first column in listview be aligned right?

 

 
Powered by phpBB® Forum Software