0

I want to click the button to login the website using Edge Browser. So, I've used the following code to open the webpage in Edge instead IE.

When i trying to create a code for click the button. It throws "Object Variable or With Block Variable not set". In my organization we're not allowed to install any extra plugins like "Selenium-webdriver".

So, please someone help me to resolve this.

Code:

Sub OPS()    
    Dim doc As HTMLDocument    
    Dim myBtn As Object    
        Set obj = CreateObject("Shell.Application")    
        obj.ShellExecute "microsoft-edge:http://*************************.aspx"
        ' (Due to sensitive nature, I've put '*' instead of the website URL)    
        Application.Wait (Now + TimeValue("00:00:02"))    
        Set myBtn = doc.getElementById("ctl00_ctl36_g_679d59b8_c496_4c55_9e06_d920dc9e0fb7_ctl01_ctl00_toolBarTbl_RptControls_ctl00_diidIONewItem")    
        myBtn.Click    
End Sub
braX
  • 11,506
  • 5
  • 20
  • 33

0 Answers0