Results 1 to 5 of 5

Thread: [RESOLVED] Printer.Font.Underline not working

  1. #1

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Resolved [RESOLVED] Printer.Font.Underline not working

    In the following code the Underline property is not behaving correctly. See the result in the screen shot below. I've tried with different fonts and only 'Symbol' worked.

    Printer is the default printer, a pdf writer.

    Code:
        With Printer
        
            .ScaleMode = vbMillimeters
            .Font = "Arial"
                    
            .Font.Size = 14
            s = "Test Title"
            .CurrentX = 0.5 * (.ScaleWidth - .TextWidth(s))
            .CurrentY = 10
            .Font.Underline = True
            Printer.Print s
            .Font.Underline = False
            
            Printer.Print
            
            .Font.Size = 12
            .CurrentX = 20
            Printer.Print "Date: " & Format(Date, "dd-mm-yyyy")
            .EndDoc
        
        End With
    Name:  misbehavior.jpg
Views: 300
Size:  6.5 KB
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,747

    Re: Printer.Font.Underline not working

    When I replace the Printer object with the current form then it seems to work.
    Code:
      Dim s As String
      
      With Me
        
        .ScaleMode = vbMillimeters
        .Font = "Arial"
                
        .Font.Size = 14
        s = "Test Title"
        .CurrentX = 0.5 * (.ScaleWidth - .TextWidth(s))
        .CurrentY = 10
        .Font.Underline = True
        Print s
        .Font.Underline = False
        
        Print
        
        .Font.Size = 12
        .CurrentX = 20
        Print "Date: " & Format(Date, "dd-mm-yyyy")
      End With

  3. #3

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Printer.Font.Underline not working

    Yes, the problem is only when I use the printer.

    Actually I have checked that it does work on a real printer. The trouble seems to be associated to the specific pdf converter I'm using.

    Definitely the VB code seems to be OK.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  4. #4

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Printer.Font.Underline not working

    Indeed... I have tried out a different pdf converter and it works fine.

    Quote Originally Posted by Me View Post
    Yes, the problem is only when I use the printer.

    Actually I have checked that it does work on a real printer. The trouble seems to be associated to the specific pdf converter I'm using.

    Definitely the VB code seems to be OK.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  5. #5

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Printer.Font.Underline not working

    Moreover:

    The code works on a different computer where that pdf converter' version is different.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

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