donald_dark
New Member
- Joined
- Oct 25, 2021
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Dear Community,
I have the following problem:
I have written a code to automate from web browser. Where data from excel spreadsheet is used to fill webforms. The code itself works fine.
I would like to write the macro in such a way that the user can choose which browser is used for automation.
Since I used Selenium to automate Chrome, Edge and so on, some users will fall back to Internet Explorer, since there is no need to install anything else here.
I wrote my main macro which runs the macro for IE or the macro for the other browsers (using Selenium) depending on the user's choice.
Unfortunately, in the macro for the Selenium browsers, I have to declare the Webdriver variable outside the sub so that the browser remains open after the macro ends.
However, for all those who do not have SeleniumBasic installed, this of course creates a compilation error.
Maybe someone has an idea how to work around this problem.
I would like users of IE not to have to install SeleniumBasic. So that all variables of type Selenium only come into play when the user selects Chrome, Edge or so. If I declare the WebDriver in the sub, everything works. However, the browser window then closes at the end.
With kind regards.
I have the following problem:
I have written a code to automate from web browser. Where data from excel spreadsheet is used to fill webforms. The code itself works fine.
I would like to write the macro in such a way that the user can choose which browser is used for automation.
Since I used Selenium to automate Chrome, Edge and so on, some users will fall back to Internet Explorer, since there is no need to install anything else here.
I wrote my main macro which runs the macro for IE or the macro for the other browsers (using Selenium) depending on the user's choice.
Unfortunately, in the macro for the Selenium browsers, I have to declare the Webdriver variable outside the sub so that the browser remains open after the macro ends.
VBA Code:
Private browser as WebDriver
Maybe someone has an idea how to work around this problem.
I would like users of IE not to have to install SeleniumBasic. So that all variables of type Selenium only come into play when the user selects Chrome, Edge or so. If I declare the WebDriver in the sub, everything works. However, the browser window then closes at the end.
With kind regards.