I want to operate IE11 from VBA in Excel (Office 365) and use getElementsByClassName to count how many elements have the same class name.Error message
Run-time error '438':
The object does not support this property or method.
Checked Microsoft Scripting Runtime, Microsoft Internet Controls, and Microsoft HTML Object Library in reference settings
Private Sub CountClass () Dim IEobj As New Internet Explorer Medium IEobj.Navigate URL Call Util.WaitingForLoad (IEobj) 'Call a function that waits for IE loading and wait a little Dim myObj As Object Dim Counter As Integer For Each myObj In IEobj.Document.getElementsByClassName ("TestClass") ' Counter = Counter + 1 Next End Sub
・ I have made similar tools using Excel (Office 365) and IE11 before, and they still work, so I set them to the same code and reference settings as the tools that are working except URLs. I tried it, but the same error doesn't happen
・ Confirm that there is definitely at least one "TestClass" class on the site
・ After searching, I found that "s" of getElements is missing or ClassName is HTML Collection, etc., but I think there is no problem
・ The same error will occur even if it is executed after taking a long time to load IE and displaying it securely
・ GetElementById and getElementsByTagName work for some reason.
I'm sorry, please help.
Answer # 1
What is the document mode of IE displayed on the target "URL" page?
getElementsByClassNameis not supported for IE8 and below.
- vba - syntax error: multiple area selection
- vba - win32 api run-time error setthreaddesktop
- vba - no error occurs in docmdtransferspreadsheet in the form of operating access from excel
- vba - network interface: an error occurred while locating the specified server/instance
- i want to copy a sheet to the end of another book with vba, but i get an error
- vba "run-time error '1004'" error that cannot be copied
- vba - compile error correction candidate: about the end of the statement
- vba - i don't understand the cause of the error code "object variable or with block variable not set"
- vba error handling
- excel vba causes automation error when duplicating sheet
- vba error handling index is not in the valid range
- vba error handling "" range "method failed:" _global "object"
- about excel vba out of memory error
- i get an error when getting a url using ie with vba
- excel vba that does not overwrite and save only when an error occurs
- vba - i don't know where the syntax error is in the advanced filter in the excel macro
- vba - i want to post between books, but a definition error occurs
- vba - error 1004: not reflected when referencing another sheet and vlookup
- [vba] i get an "element not found" error when web scraping with selenium
- [vba] an error occurs when trying to save a recordset to adodbstream