Solved

Excel VBA - How to Close a PDF File?

Posted on 2014-03-18
1
3,923 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 39942173
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do "runtime modules" work in Excel? 6 53
To array or not to array 11 78
Excel IF statement 4 28
count values within multiple bands 7 34
Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
Companies keep a much closer eye on costs today, so changing to new Technology – Microsoft Office 365 is the smartest move to take.
The viewer will learn how to edit text. This includes Font, Spacing, Resizing, Color, and other special text options.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

738 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