DDE : DocOpen

Acrobat (Or, Acrobat Reader) is returned to former size, and PDF file is displayed at the same time.
It is possible to use it by both Acrobat and Acrobat Reader.

Syntax

[DocOpen(char* fullPath)]

Argument

fullPath
[char*]
The full path of PDF file

Returns

true The PDF document is opened successfully
false Otherwise.

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

Sample: VBA of Excel

The PDF document is opened.

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

Sub DDE_DocOpen()
Dim lChanNo     As Long     ‘DDE channel number
    Dim strFilePath As String   ‘The full path of PDF file
    ‘A double quotation mark is added for blank starting full path.
    strFilePath = “””E:\iac_developer_guide.pdf”””

‘The Acrobat Reader application is Started.
    ‘Attention: It is necessary to change passing by the environment.
    Shell “C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe”
    ‘Open of DDE channel
    lChanNo = DDEInitiate(“Acroview”, “Control”)

‘PDF is opened and displayed.
    DDEExecute lChanNo, “[DocOpen(“ & strFilePath & “)]”

‘The Acrobat applicaton is ended..
‘If this is not done, the Acrobat process remains.
    DDEExecute lChanNo, “[AppExit()]” 
    ‘The DDE channel is shut.
    DDETerminate lChanNo
End Sub

Remarks

  • The Acrobat application minimized by the taskbar opens the PDF document, returns to former size, and displays the screen. Please note the thing that returns from the minimized state to former size.
  • Success/failure cannot be judged by acquiring the return value of DDE Message in Excel VBA. Please test well.

Environment to confirm the operation

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