Tag: 内联网

VBA – 在内部网上抓取网页

我写了一个VBA代码,这样我就可以在公司的内部网上取消数据。 问题: 当我运行代码时,发生下面的错误。 Run-time error '91': object variable or with block variable not set 它发生在下面的代码行上。 myPoints = Trim(Doc.getElementsByName("price")(0).getAttribute("value")) 当我debugging它并逐行运行时,它可以检索所有的值。 可能是我错过了一个error handling程序? input和输出: 我在列B上input多个产品ID并在列C上检索数据: B列=产品ID C栏=价格 HTML: <td id="myPower_val_9" style="visibility: visible;"> <input type="text" disabled="disabled" value="300" name="price"></input> </td> VBA: Sub Button1_Click() Dim ie As Object Dim r As Integer Dim myPoints As String Dim Doc As HTMLDocument […]

从互联网打开Excel文件打开一个空白的Excel窗口

将GridView转储到Excel文件从Internet上下载/打开的方法最近被新的Windows更新破坏了。 我的代码从GridView转换为使用StringWriter,HTMLTextWriter和RenderControl的XLS文件。 使用以下代码从http://www.aspsnippets.com/Articles/Export-GridView-to-Excel-in-ASPNet-with-Formatting-using-C-and-VBNet.aspx Protected Sub ExportToExcel(sender As Object, e As EventArgs) Response.Clear() Response.Buffer = True Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.xls") Response.Charset = "" Response.ContentType = "application/vnd.ms-excel" Using sw As New StringWriter() Dim hw As New HtmlTextWriter(sw) 'To Export all pages GridView1.AllowPaging = False Me.BindGrid() GridView1.HeaderRow.BackColor = Color.White For Each cell As TableCell In GridView1.HeaderRow.Cells cell.BackColor = GridView1.HeaderStyle.BackColor Next […]