
Problems with Printer in VB4
I do know what you are talking about. I had the same problems to. The
following code will work
Printer.Print
Printer.FontName = "Arial"
Printer.FontSize = 11
Printer.Print "Dette er en test."
Printer.EndDoc
It seems that you have to send "nothing" to the printer object before
you can change the font. Don't ask me why!!
Hope this helps!
Quote:
>I am using VB4 and am having problems with the printer: namely, if I
>change a font or other attribute using Printer.Font.Name = XXX for
>instance, the output remains unchanged. Here's the particular code I am
>using:
>Printer.Font.Size = 8
>Printer.Font.Name = Printer.Fonts(varPrinterFont) 'to make sure
>it's valid
>Printer.Font.Size = 8 'I read somewhere that under certain circumstances
>you need this line *twice* for some strange reason, hence above
>Printer.Font.Italic = True
>Printer.CurrentX = varOffsetX
>Printer.CurrentY = varOffsetY
>Printer.Print "BlahBlahBlah"
>All that happens is the printer uses it's usual font, with no italics
>etc. If I then use
>Debug.Print Printer.Font.Name
>then VB claims that the printer is using a *different* font, ie the one
>I have tried to allocate, than the one which the printer is clearly
>printing in.
>I have also tried using
>Printer.FontName = XXX
>etc. which has much the same effect (some books seem to claim that
>Printer.Font.Name is correct, and others suggest you use
>Printer.FontName - which is recommended?).
>Occasionally the printer has responded but the results have been erratic
>to say the least, and unreproducable. For instance, the printer will use
>Italics as suggested but will keep the font size the same, and will
>suddenly start underlining for no obvious reason.
>I am using a HP Deskjet 560C but have found the same lack of
>co-operation when using an HP Laserjet 4L. Is this a problem with HP or
>a general fault? Or is it just me being stupid?
>Thanks for your help. Please reply via e-mail as my News reading s/w is
>temperamental.
>-dave
Ulf Erik Forsbakk