-1
我可以將元素內部文本刮到文本框中,然後我可以把它放到我的Excel表格中,但所有元素都在一個單元格「A1」中結束。我如何獲得Excel中列出的A1到A100的元素。示例將是一個很大的幫助,謝謝。VB.net刮和粘貼
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.All
For Each curElement As HtmlElement In theElementCollection
If curElement.GetAttribute("classname") = "dtstart time" Then
TextBox1.Text = TextBox1.Text & curElement.InnerText & Environment.NewLine
End If
............................................ .................................................. ....... ........................................... ........
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
oExcel = CreateObject("Excel.Application")
oBook = oExcel.workbooks.add
oSheet = oBook.worksheets(1)
oSheet.range("A1").value = TextBox1.Text
oBook.saveas("C:\Users\garymcmanus\Desktop\test.xls")
oBook.close()