Buongiorno !
sto facendo una gestione di allegati in VB6; ho scaricando una libreria per il trattamenti dei documenti PDF e in particolare mi serve per unire alcuni documenti PDF per farne diventare uno.
In pratica il codice di esempio è il seguente :
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Dim WithEvents oPDFmaker As PDFmaker.CreatePDF
Dim AppName As String
Dim AppPath As String
Private Sub Command1_Click()
'This example creates a single PDF file from a JPG file, an Excel worksheet, and a
'Word document
Dim strPDF As String
Dim strPDF1 As String
Dim strPDF2 As String
Dim strPDF3 As String
Dim pdf(2) As String
On Error Resume Next
'Note: You must have Adobe Acrobat installed before this function
'will work.
Screen.MousePointer = vbHourglass
Call oPDFmaker.CloseAcrobat 'ensure Acrobat is closed
strPDF = "c:\appo\multiple.pdf"
'Create PDF1
strPDF1 = "c:\appo\4.pdf"
'Create PDF2
strPDF2 = "c:\appo\doc1.pdf"
'Create PDF3
strPDF3 = "c:\appo\doc2.pdf"
'store PDF file names in one dimensional array - order is important!
pdf(0) = strPDF1
pdf(1) = strPDF2
pdf(2) = strPDF3
'finally combine all the PDF files into one PDF file!
oPDFmaker.CreatePDFfromMultiPDF strPDF, pdf
Screen.MousePointer = vbDefault
If Err.Number Then
MsgBox Err.Number & " : " & Err.Description, vbExclamation, "Error Message"
Else
'open PDF file
oPDFmaker.OpenPDF strPDF
'ShellExecute 0, vbNullString, strPDF, vbNullString, vbNullString, 1
End If
End Sub
-----> Fine codice
Putroppo mi da errore 91 Err.Number : Variabile oggetto o variabile del blocco with non impostata;
Come mai ?
Notate qualcosa di strano in questo codice ?
Questo codice doveva servire a trasformare i doc e .xls in PDF per poi unirli tutti;
per semplificare la cosa ho messo nella cartella c:\appo 4 .PDF per fare la prova
Aspetto notizie da qualcuno esperto per favore.
GRazie anticipatamente.
Mirco