Solved

Printer error 800a01e2

Posted on 2000-04-06
12
512 Views
Last Modified: 2008-03-17
I wrote a Dll in vb 6 which does nothing but print to a printer the variables it is passed.

This dll works fine on my system but when it is moved to the server it gets a printer error 800a01e2 when ever it comes across the statement printer.print.



This is my code in the dll, I left out all of the properties for space on this message.
(keep in mind this dll runs fine when called from my system.  To debug it i commented everything out except the first printer.print statement, that is where it is failing.


Public Sub Print_Certificate()
Dim CurrentNum As Long
Dim x As Printer
   
    For Each x In Printers
        Set Printer = x
        If Printer.DeviceName = myPrinter Then
            Set Printer = x
            Exit For
        End If
    Next x
   
    Printer.FillStyle = 2
'    Printer.FillColor = RGB(0, 0, 255)
'
'    CurrentNum = 0
'    Printer.FontSize = 10
'    Printer.Font = "Verdana"
'
        'Skip down 11 lines for the first gift certificate
'        For I = 1 To 11
'            Printer.Print " "
'        Next I
'
'        If MYGID1 = "" Then GoTo Finish
'
'        'Use tab location 36
'        Printer.FontSize = 10
'        Printer.Print Tab(37); "For: "; myLinefor; Tab(71); "From: "; myLinefrom
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(36); myLineAmount; Tab(71); myLineExpires
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(37); MYGID1 'provided by asp call for the number
'        Printer.FontSize = 8
'        Printer.Print " "
'        Printer.Print Tab(47); myLine4 'Detail line 1
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(49); myLine5 'Detail line 2
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(52); myLine6 'Detail line 3
'
'
'        If MYGID2 = "" Then GoTo Finish
'
'        For I = 1 To 11
'            Printer.Print " "
'        Next I
'
'        'Use tab location 36
'        Printer.FontSize = 10
'        Printer.Print Tab(37); "For: "; myLinefor; Tab(71); "From: "; myLinefrom
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(36); myLineAmount; Tab(71); myLineExpires
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(37); MYGID2 'provided by asp call for the number
'        Printer.FontSize = 8
'        Printer.Print " "
'        Printer.Print Tab(47); myLine4 'Detail line 1
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(49); myLine5 'Detail line 2
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(52); myLine6 'Detail line 3
'
'        If MYGID3 = "" Then GoTo Finish
'
'        For I = 1 To 11
'            Printer.Print " "
'        Next I
'
'        'Use tab location 36
'        Printer.FontSize = 10
'        Printer.Print Tab(37); "For: "; myLinefor; Tab(71); "From: "; myLinefrom
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(36); myLineAmount; Tab(71); myLineExpires
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 10
'        Printer.Print Tab(37); MYGID3 'provided by asp call for the number
'        Printer.FontSize = 8
'        Printer.Print " "
'        Printer.Print Tab(47); myLine4 'Detail line 1
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(49); myLine5 'Detail line 2
'        Printer.FontSize = 4
'        Printer.Print " "
'        Printer.FontSize = 8
'        Printer.Print Tab(52); myLine6 'Detail line 3
'
'
'Finish:
'    Printer.EndDoc
'
End Sub


Any suggestions as to why this would return a printer error 800a01e2 when it tries to do printer.print??
0
Comment
Question by:jtjcomp
  • 6
  • 2
  • 2
  • +2
12 Comments
 
LVL 1

Expert Comment

by:cchenoweth
ID: 2689761
Ok..  stupid question for you.  Does the server see that shared printer (can you print from other programs?)  Is the MyPrinter Var set right?

0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2689973
Yes i can print to it
0
 
LVL 1

Expert Comment

by:cchenoweth
ID: 2689991
what is the Myprinter Var set to?
0
 
LVL 1

Expert Comment

by:ATM
ID: 2690017
Have You try to use printer from ASP?
0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2690235
Here is an update:

I made a vb app that uses that dll and installed it on the server. It worked. the dll printed.  

Then i tried to call the dll from my asp page, it failed.

so what am i missing that allows it to work if vb calls it and does not allow it to work if asp calls it.

When i call with asp the object is created fine and the functionality is passed to the dll.  I know this because i commented all the printer.print statements out and the asp page worked fine.  This means that the dll opened executed the select printer code then closed.

0
 
LVL 2

Expert Comment

by:damienm
ID: 2690300
You should not set printer = x until the printer has found x.  If it does not find x it will then print to the default printer (as opposed to giving an error message).

Try using this code instead

Public Sub Print_Certificate()
Dim CurrentNum As Long
Dim x As Printer
     
For Each x In Printers
    If UCase(x.DeviceName) = myPrinter Then
        Set Printer = x
    End If
Next x

Printer.print "Test"

End Sub

0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 1

Author Comment

by:jtjcomp
ID: 2690437
Yes i switched it but that code was already working, (it was the code that was not commented out.)

anyway same deal even when swithed.
0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2690455
Heck if it would print to the default printer that would be better then what it is doing now...
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 200 total points
ID: 2690485
0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2690486
Heck if it would print to the default printer that would be better then what it is doing now...
0
 
LVL 1

Author Comment

by:jtjcomp
ID: 2690550
The article was perfect.
thanks
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2690564
Anytime  =)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now