Results 1 to 5 of 5

Thread: <?>

  1. #1

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    I have a Birthday app and to make things small I've done it using a text file...everything is a go except for printing.
    Example.
    I wanted to use the Printer.Print but when I do my columns don't line up.
    Example, this tmp file looks like this.
    Code:
    Jan  01  1928      Gaudon Lillian          
    Jan  10  1971      White Sally             
    Jan  14  1963      Campbell Darryl         
    Jan  14  1964      White Scott             
    Jan  17  1991      White Michelle          
    Jan  24  1988      Townsend Joshua         
    Feb  01  1962      Snook Gary          
    
    When I print it it looks like this.
    ..not exactly but a general idea..it's off balance.
    
    Jan 01  1928      Gaudon Lillian          
    Jan  10   1971      White Sally             
    Jan  14    1963      Campbell Darryl         
    Jan  14 1964      White Scott             
    Jan   17  1991     White Michelle
    To get around this I use the word object and get everything all lined up and printing fine. However, that sort of defeats the whole objective...I don't want the user to have anything installed for the app to work..ie Word/Access or anything...I want it basically generic.

    Any ideas on how to deal with this..
    I tried using a fixed font like Courier, but it made no difference.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Have you tried putting vbTab between the colums? That may help

  3. #3
    jim mcnamara
    Guest
    HSJ - We do this kind'o'crud every day.

    I'm not sure about how you fielded your data, but you have some choices:

    1. use a fixed pitch font - Courier New is on every printer that supports TrueType fonts. Fairly Easy.

    2. Use .CurrentX
    Printer.ScaleMode = vbInches
    Printer.Currentx = 1
    Printer.Print Name$
    Printer.Currentx = 2
    Printer.Print Month$
    Printer.Currentx = 3
    Printer.Print day$
    Printer.Currentx = 4
    ...................... you get the idea. Not too easy

    If one of these doesn't work , get back to me, you can use Textwidth and mees arounf with controls, but it's a LARGE code chunk & I don't have the code around here. Hardest of all, codewise


  4. #4

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    chrisjk
    Thanks, I had tried that earlier in the game....least ways I am 99% sure I did so in this case I tried Jim's code prior to yours. Thanks for the answer and believe me, I would have given it another go if Jim's had failed.

    jim mcnamara

    Worked like a charm:

    Code:
    Dim a, b, c
        a = Printer.FontName
        b = Printer.FontSize
        c = Printer.ScaleMode
        Printer.Font = "courier new"
        Printer.FontBold = True
        Printer.FontSize = 12
        Printer.Print ""
        Printer.Print ""
        Printer.Print ""
        
        Open App.Path & "\tmp.txt" For Output As #1
       
        For i = 0 To List3.ListCount - 1
           Print #1, List3.List(i)
           Printer.ScaleMode = vbInches
           Printer.CurrentX = 1
           Printer.Print Left(List3.List(i), 3);
           Printer.CurrentX = 1.5
           Printer.Print Trim(Mid(List3.List(i), 6, 2));
           Printer.CurrentX = 2
           Printer.Print Trim(Mid(List3.List(i), 8, 6));
           Printer.CurrentX = 2.75
           Printer.Print Trim(Right(List3.List(i), Len(List3.List(i)) - 14))
           
           Next i
              Close #1
       
        Printer.Font = a
        Printer.FontBold = False
        Printer.FontSize = b
        Printer.ScaleMode = c
        Printer.EndDoc
        
        Label1.Caption = "Please Wait..Printing"
        Label1.Visible = True
        HideOpt
        Pause 4000
        Label1.Visible = False
        ShowOpt
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Wayne, will it 'coz by the text is having different weight? Or you can try to use the Courier or NewCourier.

Posting Permissions

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



Click Here to Expand Forum to Full Width