Hi,

I'm stuck on a printer error and I'm hoping someone can help. First a disclaimer, I'm new to Visual Basic and brand new to .dlls. I hope you don't mind the long description.

I need to print some bar codes to a bar code printer, but for the sake of this letter, I'm just sending some simple text to a printer.

I created a simple Visual Basic program that will work on any computer on the network as long as the printer driver is installed. This script will work on our NT4 server as well as any windows 95 or 98 workstation.

Now, I'm making a similar .dll that I can access from ASP via a web browser. I cut and pasted the same code from the Visual basic application and it works fine on my computer (windows 98) as the web server.

But . . . I put the .dll on the NT 4 server and do a regsvr32.exe c:\. . . . BarCodeLabel.dll. I get a print error. The error is as follows:

BarCodeLabel14 error '800a01e2'

Printer error

/test.asp, line 15

My ASP code looks like this:

<%
Set i = Server.CreateObject("BarCodeLabel.Print")
a = i.PrintLabel
Response.Write(a)
%>

Very simple but it doesn't seem to work.

Now, to try to isolate it down, I can wrong a simple function like taking a number and returning that number *2. It works fine. I can even do this:

Dim X As Printer
For Each X In Printers
If X.DeviceName = strPrinterName Then
Set Printer = X
End If
Next

It works fine. But once I do:

printer.print "anything" (this could be the whole function and the same thing happens)

It gives this error. I tried with Printer.EndDoc at the end, I tried without. I tried larger amounts of text, I tried very simple. I tried everything that I know.

The funny thing is that it works perfectly on my windows 98 machine for anything I try, but nothing that I do that has the printer.print in it works.

Is there a component that needs to be added to the .dll when it is compiled?

I don't even know enough about Visual Basic to trap the error and send it back to the browser. Any help would be greatly appreciated.

Thanks a bunch in advance,
Scott Forsyth