Use AntView in Microsoft Excel
You can use the AntView control via VBA in Microsoft Excel.
The steps to do so are as follows (note that the initial register step is not required if you installed AntView via the installer).
- Register the AntView.ocx file via regsvr32 from an elevated command prompt.
Now
- Create a new excel sheet
- Go to Developer Mode via the Ribbon (Developer mode can be enabled via File -> Options -> Customize Ribbon -> Add a checkbox in "Developer" on the right treeview) -- or use Alt+F11 to go there.
- Insert a UserForm via the menu -> Insert -> UserForm
- This should popup the ToolBox dialog (if not, it is under menu View) and you can right click on that. Select "Additional Controls..."
- This will show a long list with "Available Controls". Near the top there's an item "AntView MS Edge WebView2 Browser Control". Tick the checkbox in front.
- You can now use the AntView control in your VBA programs
Make sure to check out the Excel demo in the Antview folder under your "Public Documents" folder (C:\Users\Public\Documents)
It should show some of the things you can do.
The following is not a problem if you used the AntView installer.
This is because the installer puts the webview2loader.dll in a known location and notifies the AntView control about that.
Depending on the version of Excel that you are using, there's a chance that you get the following error that the control cannot be instantiated.
"Edge initialisation error" "Unable to initialise the Edge loader. Make sure that the file 'WebView2Loader.dll' can be located by your application."
This means that the WebView2Loader.dll file is missing in the Excel folder. First locate where your Excel binary is located (Hint: In task manager, locate Excel -> right click -> Open File Location)
Check if the WebView2Loader.dll file is in that folder, if not, then copy it from the AntView installation folder (C:\Program Files (x86)\AntView ), you can find the dll in the Win32 folder for a 32 bits version of Excel and in the Win64 folder for a 64 bits version of Excel.
AntView - The MS Edge WebView2 ActiveX control Date last changed: 09/25/2024