Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Apr 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HOW DO I LEFT JUSTIFY (VB/VBA)

    Hans,

    How can I left justify the following:
    With THISFORM.lblBAD
    .Top = 270
    .Left = 10
    .Width = 60
    .FONTBOLD = True
    .FONTSIZE = 15
    .AutoSize = True
    .WordWrap = True
    .caption = "SHIP DATE IS IN PRIOR PERIOD, PLEASE REVIEW"
    .Visible = True
    End With
    currently because of word wrap being on (and yes I need it on) the output looks like this:
    SHIP DATE IS IN
    PRIOR PERIOD,
    PLEASE REVIEW

    Any Suggestions?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HOW DO I LEFT JUSTIFY (VB/VBA)

    I don't understand what you want. Could you give a better explanation? From your post, it looks like what you say you want left justified is left justified.
    Legare Coleman

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: HOW DO I LEFT JUSTIFY (VB/VBA)

    Please don't use all caps in the subject, it looks as if you're shouting.

    The line breaks probably fall in such a way that the spaces between words are pushed to the beginning of a sentence. You can avoid this by inserting line breaks programmatically:
    <code>
    .Caption = "SHIP DATE IS IN" & vbCrLf & "PRIOR PERIOD," & vbCrLf & "PLEASE REVIEW"
    </code>
    Note the absence of spaces (in the quoted strings) immediately before or after the vbCrLfs.

  4. #4
    2 Star Lounger
    Join Date
    Apr 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HOW DO I LEFT JUSTIFY (VB/VBA)

    My apologies I did not even realize it.

  5. #5
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: HOW DO I LEFT JUSTIFY (VB/VBA)

    You'll never get it with that width & Autosize will mess you up & you need to insert the line breaks:
    <pre> With lblBAD
    .AutoSize = False
    .Top = 270
    .Left = 10
    .Height = 470
    .Width = 140
    .FontBold = True
    .FontSize = 15
    .WordWrap = True
    .TextAlign = fmTextAlignRight
    .Caption = "SHIP DATE IS IN" & vbCr & "PRIOR PERIOD," & "PLEASE REVIEW"
    .Visible = True
    End With
    </pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  6. #6
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: HOW DO I LEFT JUSTIFY (VB/VBA)

    Actually if you use fmTextAlignLeft instead of Right like I used, you don't need the line breaks if you set AutoSize False
    <pre> With lblBAD
    .AutoSize = False
    .Top = 270
    .Left = 10
    .Height = 470
    .Width = 140
    .FontBold = True
    .FontSize = 15
    .WordWrap = True
    .TextAlign = fmTextAlignLeft
    .Caption = "SHIP DATE IS IN PRIOR PERIOD, PLEASE REVIEW"
    .Visible = True
    End With
    </pre>

    Sorry for the mistake. --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  7. #7
    2 Star Lounger
    Join Date
    Apr 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HOW DO I LEFT JUSTIFY (VB/VBA)

    thank you everybody for your input, it is very much appreciated as always.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •