Quantcast
Channel: Adobe Community: Message List - Acrobat SDK
Viewing all articles
Browse latest Browse all 10848

Open Multiple PDFs from within excel using VBA

$
0
0

Hi,

I'm using excel 2010 and would like to open pdfs based on filenames I have listed in excel.

 

I attached a little of my code below which gives an idea of what I'm doing.

 

First question:
Is there a way to open mutiple files so that they are in one "instance" of adobe?

The way this currently works, is it opens up a whole new window for each file which can make desktop very cluttered.

 

Second question:
Our pdfs are actually in Sharepoint and so what I am first doing, is converting the URL to point to a mapped directory of the Sharepoint Site.

For this to work, the user must first map the sharepoint directory to a specific drive letter.
I'm wondering if there's a way to pass an actual URL via a shell command so I can skip the mapped drive bit?  When I try it, it doesn't open the file.

 

Thanks!

 

My current vba:

 

'sFileName = full URL of the file in sharepoint

 

     'Replace URL with Mapped Directory

        sFileName = Replace(sFileName, "http://aamteams.alv.autoliv.int/sites/alvgmbu/", "A:\")

 

 

     'Replace slashes in URL

        sFileName = Replace(sFileName, "/", "\")

       

     'Test if file exists before opening so adobe doesn't hang up on opening

        If Dir(sFileName) = "" Then

            A81_Try_Opening_In_Adobe = False

            Exit Function

       

        End If

       

        l_strProg = GetDefaultProgram(sFileName)

       

        'Execute function to open PDF

        Shell l_strProg & " " & sFileName, vbNormalFocus


Viewing all articles
Browse latest Browse all 10848

Trending Articles