opening pdf in pdf reader instead of WebBrowser control in userform

Jobinkrishna

New Member
Joined
Feb 29, 2016
Messages
2
Hi , I have a vba code to display pdf file in the web browser control when we click or select link from the listbox, its working fine with my pc but on another PC its automatically opening in “pdf adobe reader” instead of web browser. how can i change this to web browser? i cannot find the reason of this, please help!!

Code:
Private Sub ListBox1_Click()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
On Error Resume Next
Dim AA1, AA2 As Variant
AA1 = UserForm6.Frame1.ListBox1.Text
AA2 = “C:\PO_Pfile\Temp1\Temp12.pdf”
FileCopy AA1, AA2
WebBrowser1.Navigate (AA1)
Workbooks(“PO_SFile”).Sheets(“Sheet2”).Range(“AP2”) = AA1
End Sub
 
Last edited by a moderator:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You may need to call ShellExecute

Private Declare Function ShellExecute _
Lib "shell32.dll" Alias "ShellExecuteA"
 
Upvote 0

Forum statistics

Threads
1,216,350
Messages
6,130,139
Members
449,560
Latest member
mattstan2012

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top