RE: Access 2003
In my application (via command button) I have successfully launched Adobe Reader with a PDF file.
The user can have multiple pdf's open (up to 4).
Does anyone have a VBA code example that will 1) check to see if Adobe Reader is active in the Task Manager, and then 2) close file "12-3456.pdf", but leave other .pdf files open for the user to view?
Using the code from these links:
......initially worked for closing one window, but now the requirement has changed. The user wants to close multiple .pdf windows.
(RE: Access 2003/ Adobe Reader X ver. 10.1.2)
When I process contracts in my app, I display .pdf files related to that contract for the user while they process the current contract.
When I go from contract #1 to contract #2, contract #1's .pdf file windows need to be closed.
I have no problem opening Adobe Reader and displaying the pdf file, that works very nicely.
The problem is in closing multiple open .pdf file windows. Up to two .pdf files can be opened and displayed for any given contract being processed
Per the Debug window example here, I need to modify my code to where I can close *all* the open .pdf Adobe Reader sessions for the previous contract
where the class = "AcrobatSDIWindow" and
Caption = "<strPrevContractNum>.pdf" and "<strPrevContractNum>.-Invoice.pdf"
From the Debug window:
Class = AcrobatSDIWindow Caption = 5-22894.pdf - Adobe Reader
Class = AcrobatSDIWindow Caption = 5-22894-Invoice.pdf - Adobe Reader
Class = AcrobatSDIWindow Caption = 5-22893-Invoice.pdf - Adobe Reader
Per the debug window example, I processed contract 5-22894.pdf first.
Then I launched contract 5-22893. At the time I launched file "893", I need to close both of the other .pdf files from the previous contract, 5-22894.
Currently, the code listed below will only close the most recently opened .pdf file.
Any suggestions would be helpful...thanks.
These functions I am using: fEnumWindows, fIsAppRunning and fCloseApp all came from the mvps.org links above.
Here is the code I am using currently:
Public Sub ClosePDF()
'interrogates to see if Adobe Reader is running in the taskbar and if it is,
'this routine will close the Adobe Reader session that is currently running...
On Error GoTo Err1
'Close the .pdf file for this contract if it is currently opened...
fEnumWindows 'get the class names for opened windows in task bar
Dim blnResult As Boolean
blnResult = fIsAppRunning("AdobeAcrobat")
If blnResult = True Then
MsgBox Err.Number & "--" & Err.Description, vbOKOnly, gblPgmName & "--" & "ClosePDF()"
Well I'm using other aproach.
I'm using dde call to acrobat.
DDEChan = DDEInitiate("Acroview", "Control")
DDEExecute DDEChan, "[FilePrintSilent(" & Chr(34) & fullPath & Chr(34) & ")]"
DDEExecute DDEChan, "[AppExit()]"
IN acrobat X they chaneged Acroview to acroviewR10