以下是从网站读取textdata并将该数据粘贴到Excel第一列(逐行)(1,1),(2,1),(3,1),反之亦然的代码。
Function Read(URL)
Set ie = Wscript.CreateObject("InternetExplorer.Application")
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
ie.Navigate(URL)
ie.Visible = 1
Do While ie.Busy
WScript.Sleep 100
Loop
Data = ie.document.documentElement.innerText
MsgBox(Data)
sp = Split(Data, " ")
b = UBound(sp)
MsgBox(b)
For i=0 To b
MsgBox(sp(i))
Next
selectexcel = InputBox("Enter the location", _
"Location of the excel file(Xls/xlsx)", _
"Enter your path here !")
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(selectexcel)
objExcel.Visible = True
rowCount = objExcel.ActiveWorkbook.Sheets(1).UsedRange.Rows.Count
colCount = objExcel.ActiveWorkbook.Sheets(1).UsedRange.Columns.Count
For i=1 To b Step 1
For j=1 To 1 Step 1
objExcel.Cells(i, j).Value = sp(i)
k = k+1
Next
Next
End Function
Read "https://www.google.co.in/?gws_rd=ssl"
Set ie = Nothing
它从头开始读取textdata,但我想从InputBox
中给出的Value中读取textdata。