GCuser99 / SeleniumVBA

A comprehensive Selenium wrapper for browser automation developed for MS Office VBA running in Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create SeleniumVBA add-in

GCuser99 opened this issue · comments

commented

Should be able to create an add-in (.xlam) as an alternative to the current .xlsm file, with Excel menu tab for performing useful tasks such as driver update, or exposing help content. Will work on this after the code has had some time in testing...

commented

Just downloaded and tried it.

I made these mods:

  • reduced SeleniumVBA.xlsm+SeleniumVBA.xlam+test_addin.xlsm to a single file SeleniumVBA.xlam preserving the (no more necessary but still working) SeleniumVBA.New_* instantiations for users convenience
  • added "Option Private Module" statement in all the test_* modules, so that all their (current and future) declaration are Private by default, and "Option Explicit" and consequent necessary and missing declarations
  • renamed NewClass to ClassConstructors
  • added ":" in the third row of ClassConstructors
  • renamed "As Web*" to "As SeleniumVBA.Web*" in all the test_* modules, so that users can just copy-paste them in their projects without risking ambiguities with local classes (even MS used the explicit module declarations in their example)

I attached my final file here, in case you'll approve my mods.
seleniumVBA.zip

commented

@6DiegoDiego9 those mods all seem good to me - thank you. On the merging of the test modules with the xlam - the reason I had them separate was to demonstrate how to reference the xlam from another project, but I suppose I can add some readme discussion in the xlam to make the desired points. It should be easier to manage the code with only the xlam (although I had written code to automatically generate the SeleniumVBA.xlsm from SeleniumVBA.xlam and test_addin.xlsm!). Anyway, I can't see a downside to just putting it all in the xlam - probably be good to keep the test mods, which serve as a crude help manual, as close to the class modules as possible. I'll make these changes along with my refactor of WebCapabilities soon.

commented

@GCuser99 thanks! yes I find the test_* modules extremely useful mainly as a guide so having them always there near to the classes is very important imho.
I immediately disliked to have to store and to open a separate file to see them.

I also share your point that test_addin.xlsm is there "to demonstrate how to reference the xlam from another project" too, but in your instructions I still see very easy to specify what they have to do since it's only a matter of copy-and-paste of the test examples.

Current instructions:
"1) Unzip/copy the seleniumVBA.xlam add-in in a folder that is accessible to all VBA projects that will reference the add-in.
2) Open an Excel macro project that will reference the add-in (test_addin.xlsm is provided).
3) In the Visual Basic for Applications select a code module, then click on Tools tab, References.
4) On the References Dialog, click on Browse, select Microsoft Excel Files as File Type, then browse to the add-in folder location and select the add-in.
5) Save the Excel macro project."

I'd just modify the point 2 to:
"2) Open your Excel macro project that will reference the add-in (for testing, just copy-paste in it some of the macro examples provided in the test_* modules of seleniumVBA.xlam)"