Home VBA macro error 91
Reply: 0

VBA macro error 91

sudipta
1#
sudipta Published in 2017-12-07 14:14:24Z

I am automating the defect logging process in JIRA application using VBA macro. I am able to log in successfully using the macro. After logging I want to click on the create button. Here I am encountering below error.

Runtime error 91
Object variable or with block variable not set

Code:

Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String

MyURL = https://jira.dofa.com
Set MyBrowser = New InternetExplorer

MyBrowser.Silent = True
MyBrowser.navigate MyURL
MyBrowser.Visible = True

Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.document
HTMLDoc.getElementById("login-form-username").Value = "af1234"
HTMLDoc.getElementById("login-form-password").Value = "Password@123"
HTMLDoc.getElementById("login").Click
HTMLDoc.getElementById("create_link").Click

End Sub

Upon degugging I am getting the error at the line:

HTMLDoc.getElementById("create_link").Click

The HTML code for the create button looks like:

a title="Create a new issue/bug/feature request/etc(Type 'c')" class="aui-button aui-button-primary aui-style create-issue" id="create_link" accesskey="c" href="/secure/CreateIssue!default.jspa">Create</a>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.250158 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO