Hi Riyaz,
While you experiment with the ActiveX stuff, for the time being, I think you
can just use the Shell command to launch the AcrobatReader itself to view the
pdf file you want to view. The following code, triggered by the "On Click"
event of a Command Button on a form, attempts to do that :
Private Sub cmdViewPDF_Click()
On Error GoTo Err_cmdViewPDF_Click
Dim stAppName As String
Dim strPathToAdobe As String
Dim strFileToView As String
Dim Result As Integer
strPathToAdobe = "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32 "
'Note the Space at the end of the above string expression.
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select Employee Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "PDFs", "*.pdf"
.FilterIndex = 2
.AllowMultiSelect = False
.InitialFileName = CurrentProject.Path
Result = .Show
If (Result <> 0) Then
strFileToView = Trim(.SelectedItems.Item(1))
End If
End With
stAppName = strPathToAdobe & strFileToView
Call Shell(stAppName, 1)
Exit_cmdViewPDF_Click:
Exit Sub
Err_cmdViewPDF_Click:
MsgBox Err.Description
Resume Exit_cmdViewPDF_Click
End Sub