Home > Software engineering >  Help: vb word PDF printing
Help: vb word PDF printing

Time:10-08

For everybody, I'm ready to word file page to print to PDF, according to different page size, add the description in the generated PDF file name to distinguish, but the operation is not very correct, run time appear the following error message,

Real-time error '- 2147417851 (80010105) :
Objects' FileToPdf 'methods' IPdfDistiller failure
'
Can someone tell me what was wrong with the
 

For I=List2. ListCount 1 To 0 Step - 1
DPath=sPath & amp; "" & amp; List2. List (I) 'to obtain the full path of the word file
If Dir (dPath) & lt;> "" Then myWord. Documents. The Open dPath 'Open the selected document
'myWord. Visible=True
K=0
The total page
'Word fileITotalPage=myWord. Selection. Information (wdNumberOfPagesInDocument)
The Set myPdfDistiller=New PdfDistiller
MyWord. ActivePrinter="Adobe PDF"
For j=1 To iTotalPage
'document page by page printing into *. Ps file
MyWord. ActiveDocument. PrintOut Background:=True, Append:=False, Range:=wdPrintCurrentPage, _
OutputFileName:=oPath & amp; "" & amp; Left (List2. List (I), Len (List2. List (I)) - (4) & amp; The sPec & amp; "-" & amp; J & amp; "Ps", _
Item:=wdPrintDocumentContent, Copies:=1, PageType:=wdPrintAllPages, PrintToFile:=True, _
Collate:=True, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
'will print *. Ps file into *. PDF file
MyPdfDistiller. FileToPDF strInputPostScript:=oPath & amp; "" & amp; Left (List2. List (I), Len (List2. List (I)) - (4) & amp; _
The sPec & amp; "-" & amp; J & amp; "Ps", strOutputPDF:=oPath & amp; "" & amp; Left (List2. List (I), Len (List2. List (I)) - (4) & amp; The sPec & amp; _
"-" & amp; J & amp; ", strJobOptions: PDF "=" "
Kill oPath & amp; "" & amp; Left (List2. List (I), Len (List2. List (I)) - (4) & amp; "-" & amp; J & amp; "Ps"
Kill oPath & amp; "" & amp; Left (List2. List (I), Len (List2. List (I)) - (4) & amp; "-" & amp; J & amp; "Log", "
K=k + 1
Text2. Text="printing status," & amp; ITotalPage & amp; "Is to print the first page," & amp; K & amp; "Page!"
MyWord. Selection. GoToNext wdGoToPage
Next j
 

CodePudding user response:

What Word version, install PDF filter?

CodePudding user response:

Word03 ~ 10 have the problem, you have installed Adobe acrobat professional and cited the Adobe distiller, don't understand why this problem, and step through is normal, normal execution when there is the problem

CodePudding user response:

Word03 ~ 10 have the problem, you have installed Adobe acrobat professional and cited the Adobe distiller, don't understand why this problem, and step through is normal, normal execution when there is the problem

CodePudding user response:

Word03 ~ 10 have the problem, you have installed Adobe acrobat professional and cited the Adobe distiller, don't understand why this problem, and step through is normal, normal execution when there is the problem

CodePudding user response:

1, every line of code is added a log, to the execution of which, the compiled test, see where program lines of code to failure,

2, every line of code to add to suspend a try,
  • Related