0

Can someone help please, i can't seem to get the below to work

Sub Automate_IE_Load_Page() 'This will load a webpage in IE Dim i As Long Dim URL As String Dim IE As InternetExplorer Dim objElement As Object Dim objCollection As Object 'Create InternetExplorer Object Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "https://Whatever" 'Not putting the URL up here IE.Navigate URL Do Until IE.ReadyState = 4: DoEvents: Loop IE.Document.getElementbyid("menuoptionCell_Excel2007+").Click '(Fails here) 'Set Button = IE.Document.getElementbyid("menuoptionCell_Excel2007+") 'Button.Click End Sub 

i have also tried

 IE.Document.getElementsbyClass("contextMenuOptionTextCell")(0).Click 

It is saying i need an object. I have tried different methods but none seem to work. I will say i am using the word "Button" loosely as its not actually a button, but not sure what it is called. Below are the identities used on the web page, and i'm not totally sure which i need to press, but neither seem to work

<td class="contextMenuOptionTextCell"> <span class="contextMenuOptionText">Excel 2007+</span></td> <td id="menuoptionCell_Excel2007+" style="vertical-align: top; width: 16px;"></td> 

thank you

Mike

4
  • As a minimum have While ie .Busy Or ie.readyState < 4: DoEvents: Wend to allow for page load. And consider a timed loop to attempt to set a reference to the object Commented Nov 16, 2018 at 17:34
  • Can you verify that IE.Document.getElementsbyClass("contextMenuOptionTextCell")(0) or getElementbyid("menuoptionCell_Excel2007+") actually returns an object? Commented Nov 16, 2018 at 19:30
  • You are trying to click TD tag. If you click on TD tag by mouse then nothing happen. I suggest you to create a HTML button inside your TD tag and than try to click the button. Commented Nov 19, 2018 at 3:06
  • Thanks guys, this isnt a web page i have built, i'm trying to learn how to automate web activity, basically trying to automate the extraction of reports with out an API. I'm not that clued up on it, so don't really know where to start, but on researching the web this is what i have found, or variants of this, and i cant get this to work. Commented Nov 21, 2018 at 11:05

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.