+ Reply to Thread
Results 1 to 5 of 5

VB problem for distiller 6 and excel 2003

  1. #1
    Registered User
    Join Date
    01-04-2007
    Posts
    3

    VB problem for distiller 6 and excel 2003

    I have used a code as shown below to create PDF file from excel. The
    code doesn't work on the version of Excel 2003. Error message comes up
    at the line 'Set myPDF = New PdfDistiller' with 'Run-time error
    '-2147024893' Automation error The system cannot find the path
    specified'. VB can identify PdfDistiller as an object. Can somebody
    help me here please?

    Dim PSFileName As String
    Dim PDFFileName As String
    Dim LogFileName As String
    PSFileName = archive_file_path & "\a " & datestring & ".ps"
    PDFFileName = archive_file_path & "\a " & datestring & ".pdf"
    LogFileName = archive_file_path & "\a " & datestring & ".log"


    space_for_graph = space_for_graph - offset_space + const_space


    ' Generate postscript file from excel file
    Range("A1:P" & space_for_graph).PrintOut copies:=1, preview:=False,
    ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True,
    prtofilename:=PSFileName


    ' convert the postscript file to .pdf
    Dim myPDF As PdfDistiller
    Set myPDF = New PdfDistiller
    myPDF.FileToPDF PSFileName, PDFFileName, ""
    Kill (PSFileName)


    Derek

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by DerekCS
    I have used a code as shown below to create PDF file from excel. The
    code doesn't work on the version of Excel 2003. Error message comes up
    at the line 'Set myPDF = New PdfDistiller' with 'Run-time error
    '-2147024893' Automation error The system cannot find the path
    specified'. VB can identify PdfDistiller as an object. Can somebody
    help me here please?

    Dim PSFileName As String
    Dim PDFFileName As String
    Dim LogFileName As String
    PSFileName = archive_file_path & "\a " & datestring & ".ps"
    PDFFileName = archive_file_path & "\a " & datestring & ".pdf"
    LogFileName = archive_file_path & "\a " & datestring & ".log"


    space_for_graph = space_for_graph - offset_space + const_space


    ' Generate postscript file from excel file
    Range("A1:P" & space_for_graph).PrintOut copies:=1, preview:=False,
    ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True,
    prtofilename:=PSFileName


    ' convert the postscript file to .pdf
    Dim myPDF As PdfDistiller
    Set myPDF = New PdfDistiller
    myPDF.FileToPDF PSFileName, PDFFileName, ""
    Kill (PSFileName)


    Derek
    Hi,

    did you check at http://www.adobe.com/support/techdocs/317147.html

    where a few problems with .pdf and Office are dealt with.

    hth
    ---
    Si fractum non sit, noli id reficere.

  3. #3
    Registered User
    Join Date
    01-04-2007
    Posts
    3
    Thank you for your help. However, I have tried the guidelines of the website, and my Adobe PDF and Distiller are working fine. They can create the PDF file I requested. The problem here is the VB code I wrote is not working when it comes to the line "Set myPDF = New PdfDistiller". The distiller doesn't start off and generate the reports I have specified. I hope you can help.

    Best regards,
    Derek

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by DerekCS
    Thank you for your help. However, I have tried the guidelines of the website, and my Adobe PDF and Distiller are working fine. They can create the PDF file I requested. The problem here is the VB code I wrote is not working when it comes to the line "Set myPDF = New PdfDistiller". The distiller doesn't start off and generate the reports I have specified. I hope you can help.

    Best regards,
    Derek
    Fortunately ( or unfortunately depending on your point of view) I have not had Adobe loaded for a very peaceful 6 months, so cannot check that, but comments from another post may help you -
    that'll be this bit then
    The Code uses the following external reference libraries:
    Microsoft Office 10.0 Object Library (9.0 also works)
    Acrobat Distiller
    Go to Tools > References in the VB Editor and check them
    and
    Please Login or Register  to view this content.
    hope something there helps, let me know how you go.
    ---

  5. #5
    Registered User
    Join Date
    01-04-2007
    Posts
    3
    Thanks for your help. However, the same problem appeared when it got to the line 'Set appDist = New cACrodist'. I think it actually has the same problem as before because, in the Class Object, the same line, ' Set odist = New PdfDistiller' was used.

    I think the problem is VB recognises PdfDistiller as a class object when you are defining it, however, it doesn't function in the way what a class object should do when the program is running.

    Actually, I have been searching for the solution for quite a while and there were one to two similar questions back to 2004. Nevertheless, no one has answered those questions. I really hope you or someone in the forum would be able to help. Thank you.

    Best regards,
    Derek

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1