Consulting

Results 1 to 2 of 2

Thread: Need help to click on ID using VBA

  1. #1

    Need help to click on ID using VBA

    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 Sub
    preview.jpg

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Moderator bump
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •