我一直在嘗試使用VBA在宏中使用對象internetexplorer.application將一些文本寫入到aspnet窗體的textarea元素中VBA:如何將值設置爲對象類型的textarea internetexplorer.application
當我添加一個手錶設置「值」屬性後的對象,我得到我的所在地(使用一個MsgBox)設置文本,但是瀏覽器亙古不似乎得到文字時,我提交。
用IE 8.0.6001和Office 2003
任何幫助/意見將非常感謝林。
感謝
Sub Test2()
Dim Title As String
Dim Comments As String
Set wb = CreateObject("internetexplorer.application")
wb.navigate2 "http://tudrintra01/ads/Lists/Tasks1/NewForm.aspx?RootFolder=%2Fads%2FLists%2FTasks1&ContentTypeId=0x01030062FE73EDFA7DA644A27CE244EA983DA4&Source=http%3A%2F%2Ftudrintra01%2Fads%2FLists%2FTasks1%2FMyItems%2Easpx"
wb.Visible = True
Title = "TITULO PRUEBA"
Comments = COMENTARIO PRUEBA" '"Comentario"
Do Until wb.readyState = 4 ' wait for page to load
DoEvents
Loop
'Si el objeto es el Titulo del task
wb.Document.getElementByID("ctl00_m_g_c0644918_3730_4e2c_8434_7b760939e3d4_ctl00_ctl04_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField").Value = Title
'Si el objeto es el Comment
wb.Document.getElementByID("ctl00_m_g_c0644918_3730_4e2c_8434_7b760939e3d4_ctl00_ctl04_ctl14_ctl00_ctl00_ctl04_ctl00_ctl00_TextField").Value = Comments
' Clean up
Set wb = Nothing
End Sub
是否有你所添加的文字或取器可以使用提交表單元素的任何事件處理程序? – barrowc 2011-01-27 01:06:03