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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,623
Office Version
  1. 2007
Platform
  1. Windows
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:

vonguyenphu

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

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

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,623
Office Version
  1. 2007
Platform
  1. Windows
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.
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,623
Office Version
  1. 2007
Platform
  1. Windows
Also check your antivirus configuration.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,276
Messages
5,641,273
Members
417,202
Latest member
AndyVBA

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
Top