Solved

Excel VBA - How to Close a PDF File?

Posted on 2014-03-18
1
3,659 Views
Last Modified: 2014-03-22
Hi,

I would like to close a pdf file programmatically  using Excel 2010 ( VBA ) regardless of the Adobe Program ( e.g. Adobe Reader, Adobe Acrobat, Adobe Acrobat Pro etc ) that is used to open the said file.

Facts
1. OS: windows 7, 8
2. the pdf file ( e.g. test1.pdf )  can be opened using any of the adobe programs - this depends on which program is installed in the machine
3. once the pdf file is open, it appears to be identified by its file name + adobe program i.e. test1.pdf - Adobe Reader
4. I am able to use the following code to close the file i.e.
     AppActivate "test1.pdf  - Adobe Reader"
     SendKeys "^q"

In this example, I knew the pdf file is open using Adobe Reader.

Questions:
a)How can I determine the full file name ( test1.pdf + whatever Adobe program ) so I can use AppActivate to capture the appropriate string value dynamically - at the point when the file is open programmatically ?
b) Is there a workaround to programmatically close the pdf file if route a is not possible ?

Thank you
0
Comment
Question by:Russellbrown
1 Comment
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 39942173
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meetings to discuss business process can waste time, and often do .  The meeting's dialog can get confusing when participants have different professional perspectives and backgrounds.  A jointly-developed process picture helps wade through the confu…
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now