Solved

Printer error 800a01e2

Posted on 2000-04-06
12
525 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Using "ScreenUpdating" 6 86
using web browser with BING 40 149
MS SQL store procedure to calculate and return result 6 74
Protecting vb6 & .Net code Obfuscation 18 214
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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