DDE : CloseAllDocs

All open PDF documents are shut.
It is possible to use it by both Acrobat and Acrobat Reader.

Syntax

[CloseAllDocs()]

Returns

true The all documents are closed successfully.
false Otherwise.

Notes: The return value cannot be acquired with DDE of VBA of Excel.

Sample: VBA of Excel

All open PDF documents are shut.

  • Please confirm the test by the step execution with F8 key.

Sub DDE_CloseAllDocs()
   
Dim lChanNo     As Long ‘DDE channel number
    Dim strFilePath As String ‘The full path of PDF file

‘    Shell “C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe”
    Shell
“C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe”
    ‘A double quotation mark is added for blank starting full path.
    strFilePath = “””E:\iac_developer_guide.pdf”””
 
   ‘Open of DDE channel
    lChanNo = DDEInitiate(
“Acroview”, “Control”)
    ‘Open of PDF file
    DDEExecute lChanNo,
“[DocOpen(“ & strFilePath & “)]”
    ‘All open PDF files are shut.
    DDEExecute lChanNo, “[CloseAllDocs()]”
   
   
‘The Acrobat application is end.
    ‘If this is not done, the Acrobat process remains.

    DDEExecute lChanNo, “[AppExit()]” 
    ‘The DDE channel is shut.
    DDETerminate lChanNo
End Sub

Remarks

  • Both Acrobat or Acrobat Reader end the test confirmation.

Environment to confirm the operation

  • WindowsXP + SP3 + WindowsUpdate
  • Acrobat 9.1.0 + Office Pro 2003
  • Acrobat Reader 9.1.0 + Office Pro 2003