0

根据要求,我编写了一些代码,可以做所有事情。我遇到问题的领域是它没有从 Excel 中获取表单之一的输入。

我还附上了页面的 HTML 图像。 在此处输入图像描述

Sub Appreciation()
Dim LastRow As Long
Dim IE As InternetExplorer
Dim aEle As HTMLLinkElement
Dim y As Integer
Dim reslt As String
Dim objCollection As Object
Dim doc As HTMLDocument

Dim sht As Worksheet
Set sht = ThisWorkbook.Sheets("data")

Dim i As Long

LastRow = sht.Cells(sht.Rows.count, "A").End(xlUp).Row

'Open link
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://some link"
Do
DoEvents
Loop Until IE.readyState = 4
'Open customer section
Set allhyperlink = IE.document.getElementsByTagName("A")

For Each hyper_link In allhyperlink
If hyper_link.innerText = "Add Range" Then
hyper_link.Click
Exit For
End If
Next
'linking excel
Application.Wait (Now + TimeValue("0:00:4"))

Worksheets("data").Activate
For i = 2 To LastRow   'loop
Set doc = IE.document
   IE.document.getElementById("designation").Value = 
ThisWorkbook.Sheets("data").Range("C" & i)
IE.document.getElementById("token-input-tags").Value = 
ThisWorkbook.Sheets("data").Range("F" & i)  'tags

IE.document.getElementById("frmaddcards").Value = 
ThisWorkbook.Sheets("data").Range("A" & i)
IE.document.getElementById("logopicture").Click
IE.document.getElementById("FileInput").Click


 'This is where i have problem
 doc.getElementsByClassName("cke_editable cke_editable_themed 
 cke_contents_ltr cke_show_borders")(0).Value = "ct"    'i have also 
 tried with (0), (1)...so on and also without defining the index

 Next i

 End Sub
4

0 回答 0