none
Open embedded pdf to a certain page RRS feed

  • Question

  • I've embedded a PDF into my workbook, and I need a code which will open the embedded PDF to a certain page.

    The PDF needs to be embedded in the worksheet as it must be sent outside the organisation; I don't want to send a ZIP file with worksheets and PDFs.

    So far, this is what I have in order to open the embedded PDF, and this works fine at the moment.

    "Object 2" is the name of the embedded PDF.

     Sub Macro1()
    
        ActiveSheet.Shapes("Object 2").Select
    
        Selection.Verb Verb:=xlPrimary
    
     End Sub

    If someone could help for opening the PDF to a certain page that would be great.

    Tuesday, June 6, 2017 2:19 AM

All replies

  • Hi jake94,

    you are trying to use OLEObjects.Verb in your code.

    The verb that the server of the OLE object should act on. If this argument is omitted, the default verb is sent. The available verbs are determined by the object's source application. Typical verbs for an OLE object are Open and Primary (represented by the XlOLEVerb constants xlOpen and xlPrimary).

    you need to try to use XlOpen to open that file.

    Reference:

    OLEObject.Verb Method (Excel)

    XlOLEVerb Enumeration (Excel)

    you can see that this method has only one parameter for the value of verb.

    it does not have any optional parameter that opens a specific page of PDF file.

    note that there are many file types supported by OLE Object. so object can contains word, Excel , powerpoint etc file.

    every file has different format to represent data. like excel have sheets.

    so you can only open the PDF file using this method but you can't open a specific page of the file.

    user need to open that page manually.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 7, 2017 3:23 AM
    Moderator