Re: Printer Not Activated Error Code -30

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Van - Thank you so much! You pointed me in the right direction!!!!! I
checked my pdf converter documentation and sure enough I had the code
incorrect (although not sure how it was able to work outside of a loop). In
any case, I changed the following line of code:

wordDoc.PrintOut ActivePrinter = PrinterName

to:

' Enable the printer before each printout
cdi.EnablePrinter Licensee, LicCode
wordDoc.Application.ActivePrinter = PrinterName
wordDoc.PrintOut Background:=False

Again, thank you for your help. It is much appreciated!

Jackie

"Van T. Dinh" wrote:

I can't find the argument "ActivePrinter" for the PrintOut method as applied
to the Document Object in Word 2002 VBA Help.

Check your Word version VBA Help and see if it is a valid argument in your
case???

--
HTH
Van T. Dinh
MVP (Access)



"JKro" <JKro@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:97BDA5EF-EF6D-4F91-AB65-5B26D0E2B076@xxxxxxxxxxxxxxxx
I have some code that I am running to convert a Word document to a PDF
document by printing to a PDF Converter (cdi). My code works fine when I
run
it one time, but when I run in a For/Next loop, I get the following error:

Printer Not Activated Error Code -30

I then get a large Access message that says "There isn't enough
memory."

I have pasted the code below. Please note that if I remove the For/Next
loop, the code works fine. I believe the error is occuring on the
following
line:
wordDoc.PrintOut ActivePrinter = PrinterName
Any help would be greatly appreciated.


PrinterName = "PDF Converter"

cdi.DriverInit PrinterName
cdi.SetDefaultPrinter

For x = 1 To 2
If x = 1 Then
SpecName = "C:\SpecFileA.doc"
Else
SpecName = "C:\SpecFileB.doc"
End If
cdi.DefaultFileName = "C:\SomeFolder\Spec" & x & ".pdf"
Select Case Right(SpecName, 3)
Case "Doc"
' Word document
Set wordApp = CreateObject("Word.Application")
Set wordDoc = wordApp.Documents.Open(SpecName)

wordDoc.PrintOut ActivePrinter = PrinterName
wordDoc.Close

wordApp.Quit

Case "pdf"

Case "xls"

End Select

Set wordDoc = Nothing
Set wordApp = Nothing

Next x



.