Find the address of default application

vonguyenphu

New Member
Joined
May 26, 2019
Messages
29
Hi all,

I have a module as below to open pdf files from an excel sheet

Code:
sCell = Application.ActiveWindow.ActiveCell.Text
sFile = "C:\Program Files\Nitro\Pro 11\NitroPDF C:\Users\" & Environ("username") & "\Downloads\" & sCell & ".pdf"
retal = Shell(sFile, 1)

The problem is that i need to install this macro to others' computers. But each time i have to adjust the code based on their default pdf application (they want to use their app). Followhyperlink can do that but always shows an annoying message.
Can you give me suggestion on how to find the address of the pdf default application or write a macro which is more adaptable to different computers?

Thank you!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try this

Code:
Sub test()
    scell = Application.ActiveWindow.ActiveCell.Text
    ActiveWorkbook.FollowHyperlink "[COLOR=#333333]C:\Users\" & Environ("username") & "\Downloads\" & [/COLOR]scell & ".pdf"
End Sub
 
Last edited:
Upvote 0
Hi Dante,

The FollowHyperlink always shows an annoying message when i run the macro. Do you have any solution to dismiss these messages?
 
Upvote 0
Hi Dante,

The FollowHyperlink always shows an annoying message when i run the macro. Do you have any solution to dismiss these messages?

What the message says?

It may be the version, I'm in 2007 and it does not send me the message.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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