I am pretty new to VBA and don't have much experience with it. I have a excel sheet with more then 500 commands for which I want to test if the syntax of the command is correct. To do so I thought about using VBA to automate this process.
For the start I went with just one command to see if it could work, but it does not. My code:
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
URL = "https://www.freeformatter.com/java-regex-tester.html"
IE.Navigate URL
While IE.ReadyState <> 4
DoEvents
Wend
IE.Document.getElementById("regex").Value = "\b(Yes"
IE.Document.getElementById("input").Value = "Yaes"
IE.Document.getElementById("matchesButton").Click
While IE.ReadyState <> 4
DoEvents
Wend
Set html = IE.Document
If IsNull(html.getElementById("output")) Then
Worksheets(12).Range("A2").Interior.ColorIndex = 3
End If
Set IE = Nothing
The input "\b(Yes" should be with syntax errors, so there should be this HTML code:
<div id="output" class="form-wrapper" style="margin-top:20px;padding-left:20px;">
But checking this id="ouptut" does not work, with this error there should no <div id="output" be and therefore IsNull(html.getElementById("output")) should return a Null/True and the excel cell should be marked red.
Can anyone please help me out with my logic error in the code? I tried already hours and should be simple, but I was not able to find a solution via google.