PDA

View Full Version : Need help to click on ID using VBA



Kartheek1439
11-18-2017, 11:00 AM
Hi friends,
Iam very new to VBA..
Jus trying to learn and unable to write a code... i want to click on the Page Tab of .aspx page then need to click on a Thundera preview button .
When u open this .aspx page. by default the page will open with browse tab. How to navigate to Page tab and click the button.
Attached code and screenshot for reference.
Could you please help me to resolve this code.


<a unselectable="on" href="javascript:;" onclick="return false;" class="ms-cui-ctl-large " aria-describedby="Ribbon.WikiPageTab.DellGroup.ThunderaPreviewButton_ToolTip" mscui:controltype="Button" role="button" id="Ribbon.WikiPageTab.DellGroup.ThunderaPreviewButton-Large"><span unselectable="on" class="ms-cui-ctl-largeIconContainer"><span unselectable="on" class=" ms-cui-img-32by32 ms-cui-img-cont-float"><img unselectable="on" alt="" src="/_layouts/images/zoomhh.png"></span></span><span unselectable="on" class="ms-cui-ctl-largelabel">Thundera<br>Preview</span></a>


This is the code i wrote but unable to get it done :


Sub indextest1()
Dim objIE As Object
Dim objElement As Object
' Create InternetExplorer Object
Set objIE = CreateObject("InternetExplorer.Application")
' Make sure the Internet Explorer window is visible
objIE.Visible = True
' Navigate to your URL
objIE.Navigate "My aspx page URL"
' Wait while IE loading...
Do While objIE.Busy
Application.Wait DateAdd("s", 3, Now)
Loop
DoEvents
' Get the button
ObIE.Document.getElementById("Ribbon.WikiPageTab.DellGroup.AddtoClipboardBu tton-Large").Click
' Click the button
objElement.Click
' Clean up
Set objIE = Nothing
Set objElement = Nothing
End Sub20980

SamT
11-19-2017, 10:38 AM
Moderator bump