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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

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