Question : Open and close a pdf document

I must open a pdf document so I ask you if this code is ok......

Private Sub Comando201_Click()
 Dim AcroApp As Acrobat.CAcroApp
        Dim PDDoc As Acrobat.CAcroPDDoc
        Set AcroApp = CreateObject("AcroExch.App")
        Set PDDoc = CreateObject("AcroExch.PDDoc")
       
        AcroApp.Show
        PDDoc.Open ("l:\toledo.pdf")
        PDDoc.OpenAVDoc ("l:\toledo.pdf")
       

End Sub


.....And I have a button that close the pdf open with the code upon

Private Sub close_Click()
Dim avdoc As Acrobat.CAcroAVDoc
Dim AcroApp As Acrobat.CAcroApp
        Dim PDDoc As Acrobat.CAcroPDDoc
        Set AcroApp = CreateObject("AcroExch.App")
        Set avdoc = CreateObject("AcroExch.avdoc")
        Set PDDoc = CreateObject("AcroExch.PDDoc")
        AcroApp.CloseAllDocs
        Set avdoc = Nothing
        Set AcroApp = Nothing
End Sub

In this case the document is closed but Acrobat is already active so if I try to re-open the pdf I receive the error that the file is already open.....how can I close the pdf totally?????

Answer : Open and close a pdf document

then what is the problem?  So it requires two lines of code...big deal.

AW
Random Solutions  
 
programming4us programming4us