Hello,
I am trying to read the value of a IE8 textarea using Excel 2010 VBA 7. The error I get is: "Object doesn't support this property or method" in relation to this line of code:
OldNotes = OldNotes.Value
I have also tried .innerText instead of .Value and get the same error.
Here is the website source that relates to the textarea:
<textarea name="ctl00$ContentPlaceHolder1$txtOldNotesIssue" rows="2" cols="20" readonly="readonly" id="ctl00_ContentPlaceHolder1_txtOldNotesIssue" style="height:150px;width:98%;">Text goes here
</textarea>
Here is the VBA code I am using to try and read the text area:
'Microsoft Internet Controls Reference is needed
'Microsoft HTML Object Library Reference is needed
Public Sub ReadNotes()
Dim objShellWins As SHDocVw.ShellWindows
Dim objIE As SHDocVw.InternetExplorer
Dim objDoc As Object
Dim WebCheck As String
Dim SuccessCheck As Integer
WebCheck = "CATS"
SuccessCheck = 0
Set objShellWins = New SHDocVw.ShellWindows
For Each objIE In objShellWins
With objIE
If (InStr(1, .LocationName, WebCheck, vbTextCompare)) Then
Set objDoc = .document
If (TypeOf objDoc Is HTMLDocument) Then
SuccessCheck = 1
objIE.Visible = True
'-----------This is the section of code I am having problems with--------------------------------------------------
Set OldNotes = objIE.document.getElementsByName("ctl00$ContentPlaceHolder1$txtOldNotesIssue")
OldNotes = OldNotes.Value
MsgBox OldNotes
'------------------------------------------------------------------------------------------------------------------
End If
End If
End With
Next
'If the CATS webpage is not found, displays an error message and stops the program
If SuccessCheck = 0 Then
MsgBox ("CATS webpage not found." & vbCrLf & vbCrLf _
& "Navigate to the CATS search page and try again."), vbCritical
End
End If
End Sub
Thanks in advance,
Matt
Bookmarks