2003 w/7
I'm producing PDF for a slide show and using Reader in Full Page mode to display them.
The issue was to give interim results and therefore I'd need to either Close the old file prior to generating a new (PDF) file for Reader OR I'd have to Quit Reader and make a new PDF file and open Reader again.
I decided to do the later. I tested the sub parts of this routine and they worked fine (don't like SendKeys but...)
Now that I have combined the Kill with the Open, it seems I don't get the Kill. I end up with multiple version of Reader open with different files. (iPDF is a Public variable set to 1 in the initialization routine.)
I'm producing PDF for a slide show and using Reader in Full Page mode to display them.
The issue was to give interim results and therefore I'd need to either Close the old file prior to generating a new (PDF) file for Reader OR I'd have to Quit Reader and make a new PDF file and open Reader again.
I decided to do the later. I tested the sub parts of this routine and they worked fine (don't like SendKeys but...)
Now that I have combined the Kill with the Open, it seems I don't get the Kill. I end up with multiple version of Reader open with different files. (iPDF is a Public variable set to 1 in the initialization routine.)
Code:
Sub OpenPDFdoc()
Dim j As Integer
Dim TaskID As Variant
' http://www.tek-tips.com/viewthread.cfm?qid=416162
' pieces of Code from above site
' MsgBox "This will fail if you don't have Adobe Acrobat installed :o)"
On Error GoTo 1
' Kill prior version of slide show before generating a new one.
If iPDF <> 1 And TaskID > 0 Then
AppActivate TaskID
Application.SendKeys "%{F4}", True
End If
'Launch a new slide show
TaskID = Shell("C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32.exe", vbNormalFocus)
ActiveWorkbook.FollowHyperlink ActiveWorkbook.Path & "\lmgc test files\" & "full Results" & iPDF & ".pdf", NewWindow:=True
Application.SendKeys ("^l")
iPDF = iPDF + 1
Exit Sub
1:
End Sub