Skip navigation
Currently Being Moderated

Save as PDF file as excel file or text file in vba excel

Apr 10, 2012 11:10 PM

Hi all,

 

I am opening a PDF document fromm VBA excel. After opening document it should save the document as excel file or text file in one folder.

I am trying to do this with some code but not able to , pls help me thatnks.

 

Dim AcroApp As Acrobat.CAcroApp

  Dim Part1Document As Acrobat.CAcroPDDoc

Set Part1Document = CreateObject("AcroExch.PDDoc")

   Part1Document.Open ("Z:\EG MI Information\MIS\Requests\Req_156\NO.1.pdf")

 

 

  Dim app As Object, avdoc As Object, pageview As Object

Set app = CreateObject("AcroExch.App")

Set avdoc = app.GetActiveDoc

app.MenuItemExecute ("SaveAs")

 

thanks

Abhijeet

 
Replies
  • Currently Being Moderated
    Apr 11, 2012 3:50 AM   in reply to Abhijeet4

    You want to look at the JSObject (which connects JavaScript to COM/OLE/VBA) and then the this.saveAs() method in JavaScript.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2012 2:14 AM   in reply to Abhijeet4

    Hi,

     

    Usage of the JSObject is shown in the VB Samples folder in the Acrobat SDK in this folder

    [Acrobat SDK Install location]\Version 1\InterAppCommunicationSupport\VBSamples

     

    and look in these two samples to see how to use the JSObject

    JSObjectAccessVB

    JSOFindWordVB

     

    There is also documentation on the JSObject here

    http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/IAC_DevApp _OLE_Support.100.18.html

    http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/IAC_DevApp _OLE_Support.100.13.html

     

    Hope this helps

     

    Malcolm

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2012 6:32 AM   in reply to Abhijeet4

    Hi,

     

    In the documentation for the saveAs function it has the following params

     

    cPath The device-independent path in which to save the file.

    cConvID (optional, Acrobat 6.0) A conversion ID string that specifies the conversion

    file type.

    cFS (optional, Acrobat 7.0) A string that specifies the source file system name.

    bCopy (optional, Acrobat 7.0) A Boolean value which, if true, saves the PDF file

    as a copy. The default is false.

    bPromptToOverwrite (optional, Acrobat 7.0) A Boolean value which, if true, prompts the user if

    the destination file already exists. The default is false.

     

    In order to get a text file saved you need to specify the correct cConvID.

     

    See the documentation for the valid convID's - http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_Acr oJS.88.519.html

     

    Please note the Acrobat SDK contains all the information and does not require much installing ( as it is a zip file(on windows) and a disc image (on Mac) it just needs extracted)

     

    Regards

     

    Malcolm

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2012 7:29 AM   in reply to Abhijeet4

    Hi,

     

    The cConvID was added in Acrobat 6.0 and later so it would need work, as you are seeing, in Acrobat 5.0

     

    Regards

     

    Malcolm

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2012 8:01 AM   in reply to Abhijeet4

    No, that functionality is not available in that EXTREMELY OLD version.

     

    Also, even if you were using Acrobat 7, we could not help you as we no longer support that version either.

     

    You need to upgrade to Acrobat 9.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 13, 2012 2:05 AM   in reply to Abhijeet4

    HI,

     

    The Adobe Reader software can only save files if they have been enabled by the LiveCycle Reader Extension's Server or Acrobat Professional, if you have an enabled PDF file then the script should work, although please note the documentation which says.

     

    Note: This method can only be executed during a batch or console event. See Privileged versus

    non-privileged context for details. The event object contains a discussion of JavaScript events.

     

    Please see the documentation for more information

     

    Malcolm

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 13, 2012 3:43 AM   in reply to Abhijeet4

    No, Adobe Reader does not support COM/VBA for automation.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points