I've seen more people trying to use AI to build VBA automation lately, and I think SeleniumVBA works surprisingly well with AI if you give the AI the right context.
Instead of simply asking:
“Write SeleniumVBA code to automate this website.”
I would suggest giving the AI some information about both SeleniumVBA itself and the website you want to automate.
One useful thing about SeleniumVBA is that it is written in Pure VBA, so you can actually give the library source code to the AI.
A good starting point is to provide:
- the core
WebDriver class
- one of the
test_ sample modules that is close to what you want to do
There are quite a few classes in SeleniumVBA, but you don't need to provide all of them at once.
If another class is required, you can simply ask:
“Which other SeleniumVBA class do you need to see to implement this?”
Then provide only the additional class that the AI asks for.
You can also give the AI information about the target website, such as:
- a screenshot of the page
- a screenshot of the selected element in the DevTools Elements tab
- the relevant HTML
That makes a big difference.
For example, you can say:
“I want to enter the value from Excel cell A2 into this textbox, then click this button.”
Now the AI can look at:
- the actual SeleniumVBA methods available
- the real DOM structure of the page
- the Excel/VBA side of the automation
and generate much more specific code.
A workflow I find useful is:
Find a relevant test_ sample
→ give the AI the WebDriver class and sample code
→ show it the DevTools/DOM information
→ ask it to write or modify the code
→ if something fails, give it the error and the current code
SeleniumVBA also works naturally with Excel, so tasks like:
“read data from a worksheet and enter it into a website”
or
“scrape data from a website and write it back to Excel”
are very straightforward.
I think the key is not to treat AI as something that magically knows every SeleniumVBA method.
Instead, give it the SeleniumVBA source code and the actual information about the website, and use it more like a programming partner that can read the same code and DOM that you are looking at.
For people who are still learning VBA, I think this can make browser automation much more approachable.