Printing an error report

S

Steve

I'd like to print a simple error report from the application to the default network printer without using a worksheet. The text is in a string.

Any ideas?
 
T

Tom Ogilvy

First, I went to the immediate window in the VBE to query the activeprinter
string

To a Network printer
? activePrinter
\\ARDAPS01\1D343E on Ne02:

then I used the first part in the below code:

Sub Macro5()
Dim ctrl As Long
Dim tmpstr As String
Open "\\ARDAPS01\1D343E" For Output As #1
Print #1, "[Start of Printing Test]"
For ctrl = 1 To 10
tmpstr = "Printing Line " + Str(ctrl)
Print #1, tmpstr
Next
tmpstr = "[End of printing test]" + Chr(12)
Print #1, tmpstr
Close #1
End Sub

Worked for me.

Regards,
Tom Ogilvy


Steve said:
I'd like to print a simple error report from the application to the
default network printer without using a worksheet. The text is in a string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top