ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Global variable/Print (https://www.excelbanter.com/excel-programming/307917-global-variable-print.html)

Terry V

Global variable/Print
 
Hello
How do I print the contents of a global variable to the default printer?

Thanx
Terry



Tom Ogilvy

Global variable/Print
 
Sub Macro5()
Dim ctrl as Long
Dim tmpstr as String
Open "LPT1:" For Output As #1
Print #1, "[Start of Printing Test]"
For ctrl = 1 To 10
tmpstr = "Printing Line " & cStr(ctrl)
Print #1, tmpstr
Next
tmpstr = "[End of printing test]" & Chr(12)
Print #1, tmpstr
Close #1
End Sub


Worked for me. May have to change LPT1 to address your printer.

You will have to workout how to address your printer.

Regards,
Tom Ogilvy

"Terry V" wrote in message
...
Hello
How do I print the contents of a global variable to the default printer?

Thanx
Terry






All times are GMT +1. The time now is 02:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com