I have an excel worksheet with a list of invoices and I am trying to write a macro that will load an Invoice into a text box on a website then click the Insert Button to move the invoice over to a list box....Seems pretty simple... My code runs but now invoices get entered.. essentially nothing happens...
I am using ie.Document.all.Item to refer to the items but since the object name is hidden I used the object ID Example:
Set CognosInvoiceInput = ie.Document.all.Item("PRMT_TB_N1F5BDC50x141933C8_NS_").Value = Invoice
Could this be wrong? If so what is the proper code I should use to set the value of an object field if I only have the object id?
I am using ie.Document.all.Item to refer to the items but since the object name is hidden I used the object ID Example:
Set CognosInvoiceInput = ie.Document.all.Item("PRMT_TB_N1F5BDC50x141933C8_NS_").Value = Invoice
Could this be wrong? If so what is the proper code I should use to set the value of an object field if I only have the object id?
Code:
Sub CognosMultipleInvoiceEntry()
Dim ie As Object
'Create instance of Internet Explorer
Set ie = CreateObject("InternetExplorer.Application")
Sheets("Invoices").Select
ie.Visible = True
'Open Cognos and go to the Charges/Payments/Rejections Report after Login
ie.NAVIGATE "[URL]http://bisreporting.ameripath.local/cognos8/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/cc.xts&m_folder=i48966518CD5A4C16A7B3C0FD1ADF74BE&m_folder2=m-i5BFCA28BF461469C8F07CAEF9382526A[/URL]"
Do While ie.busy: DoEvents: Loop
Do While ie.ReadyState <> 4: DoEvents: Loop
'After User has Logged into Cognos Prompt them to Open Report for additional Paramter Entry
MsgBox ("Please Login to Cognos and Click on Charges/Payments/Rejection Report after the Report has loaded press OK")
'Once the User has Entered the appropriate parameters start loading invoices
With Sheets("Invoices")
Dim lLastRow As Long, i As Long
lLastRow = [a65536].End(3).Row
For i = Range("STARTROW") To lLastRow
Invoice = .Cells(i, "A").Value
Set CognosInvoiceInput = ie.Document.all.Item("PRMT_TB_N1F5BDC50x141933C8_NS_").Value = Invoice
ie.Document.all.Item("PRMT_LIST_BUTTON_INSERT_N1F5BDC50x141933C8_NS_").Click
Next i
End With
MsgBox ("Finished Entering Invoices")
End Sub