Hi guys dont if anybody in this forum can help as I am not having a lot of luck elsewhere, I am using VBA from Access to automate IE .
and I have a piece of code that is not playing ball. It's not assigning a value to the innerHTML as expected.
Code:
Function PasteToWebPage(txt As String, ie As SHDocVw.InternetExplorer, Optional IfNotExactlyOne As htmlNotExactlyOne = htmlPasteToNone, Optional ElementID As String, Optional ClassName As String, Optional Name As String, Optional TagName As String, Optional href As String, Optional InnerHTML As String) As Long
Dim hDoc As MSHTML.HTMLDocument
Dim hCol As MSHTML.IHTMLElementCollection
Dim hSelect As MSHTML.HTMLSelectElement
'Dim Target As IHTMLInputElement
On Error GoTo errorHandler
Set hDoc = ie.Document
With hDoc
If ElementID <> "" Then
'ignores any value set for htmlNotExactlyOne
.getElementByID(ElementID).InnerHTML = txt
'If Target Is Nothing Then Err.Raise vbObjectError + 513
'Target.setAttribute "value", txt
PasteToWebPage = 1
Exit Function
End If
...
I can assign to value i.e. .getElementByID(ElementID).value = txt works fine but doesn't change the visual content on the form - confused which I should use and why its not working.
Err.Number=600 Err.Description=Application-defined or object-defined error
Any comments welcome, thanks!