I am working on a script on VBA to capture some repetitive data on a CRM web database but I am having a problem with an input field that has a required attribute and when the script enters the data and i save the values entered the element with the Required attribute does not get saved in the form and it clears the field.
Is there a way to prevent this?
i tried several methods but nothing is working, here is a sample of the way I am trying to enter the values on the input fields.
sub CRMdata()
Dim ie As New SHDocVw.InternetExplorerMedium
Dim htmldoc As MSHTML.HTMLDocument
Dim htmlcol As MSHTML.IHTMLElementCollection
Dim htmlbody As MSHTML.IHTMLElement
Dim htmlobj As MSHTML.IHTMLElement
Dim iframe As HTMLIFrame
Dim frame As HTMLFrameElement
Dim descrip1 As String
descrip1 = "name1"
'load webpage and store IE Document
With ie
.Visible = True
.navigate ("my webapge")
End With
Do While ie.readyState <> READYSTATE_COMPLETE
Application.StatusBar = "Loading WebPage..."
DoEvents
Loop
Application.Wait (Now + TimeValue("00:00:03"))
Set htmldoc = ie.document
'set iframe work area in CRM Environment
Set iframe = htmldoc.getElementById("CRMApplicationFrame")
Set htmldoc = iframe.contentWindow.document
'set frame work area 1 in CRM enviroment
Set frame = htmldoc.getElementById("WorkAreaFrame1")
Set htmldoc = frame.contentWindow.document
With htmldoc
.getElementById("C14_W65_V67_V70_V71_btadminh_struct.description").Value = descrip1
End With
'Save the CRM opportunity
'htmldoc.getElementById("C14_W65_V67_thtmlb_button_1").Click
End Sub