Need help ASAP - VBA & ActiveX web browser

napoleonjones

New member
Local time
Today, 00:47
Joined
Mar 31, 2010
Messages
1
Ok, I built a database which stores employee information and allows users to to attach pdf documents to employee records. Files are not stored in the DB only paths. I have a document viewer form that displays the pdfs using the ActiveX webbrowser control. Now everything works fine on my machine. But when one of our employees clicks the browse button and selects the pdf, its opens up in adobe reader instead of the web browser. I don't think the code is the problem, I think it maybe a setting on her computer. Any help is appreciated, I am leaving the country in 24hrs and would like this resolved before then.

This is the code used to display the document.

Private Sub Command_Browse_Click()
On Error GoTo err:

Dim fDialog As Office.FileDialog
Dim varFile As Variant

Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.Title = Title
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "PDF Files", "*.pdf"

'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
Me.Text_LoadPath = .SelectedItems(1)
objIE.Navigate Me.Text_LoadPath

Else
'MsgBox "You clicked Cancel in the file dialog box."

End If
End With

err:
Select Case err.Number
Case 0
'No error
Case 91
Set objIE = Me.WebBrowser0.Object
objIE.Navigate Me.Text_LoadPath
Resume Next
Case 424
Set objIE = Me.WebBrowser0.Object
objIE.Navigate Me.Text_LoadPath
Resume Next
Case Else
MsgBox "An unhandled error has occurred." & vbNewLine & _
"Location: frmViewDocument" & vbNewLine & _
"Module: Command_Cancel_Click " & vbNewLine & _
err.Number & vbNewLine & _
err.Source & vbNewLine & _
err.Description, vbCritical, "Unhandled Exception"

End Select




End Sub
 

Users who are viewing this thread

Back
Top Bottom