How to open default browser in excel vba on both PC and Mac

I need to open urlin default web browserusing excel vba. It should work both in PCand in Mac.

I also need to get browser instanceit so that I can access its object documentand read some html elements or something from the page displayed in the browser.

I know how to open InternetExplorerwith a help CreateObjectthat returns you a browser instance. Maybe in. MacI can open the browser Safariin the same way. But I want to open the default web browser, and also get a browser instance.

If someone did something like this, please show me a code example or point me in the right direction.

+4
source share
2 answers

I personally let Excel understand this:

ActiveWorkbook.FollowHyperlink "https://www.google.com"

I cannot check if this works on a Mac (but I see no reason why this is not).

Please note: if you want to use the default browser, you cannot guarantee that you can even get an instance of the object (for example, Chrome, Firefox, Opera, etc., etc.). I would display for the user in the browser, and then grab html from the same link at the same time with some other method.

+1
source

Can you use this to open a webpage and install a proxy as well as a user agent?

, (. ), .

0

Source: https://habr.com/ru/post/1621636/


All Articles