以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  为啥清除不了  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=42974)

--  作者:blackzhu
--  发布时间:2013/11/27 13:59:00
--  为啥清除不了
 Dim Book As New XLS.Book(ProjectPath & "data\\资料卡.xls")
    Dim sheet As XLS.sheet = Book.Sheets(0)
    sheet(4,2).Value = Nothing
    sheet(4,2).Value = nothing
    sheet(5,2).Value = nothing
    sheet(4,4).Value = nothing
    sheet(5,4).Value = nothing
    sheet(6,2).Value = nothing
    sheet(6,4).Value = nothing
    sheet(7,2).Value = nothing
    sheet(8,2).Value = nothing
    sheet(8,4).Value = nothing
    sheet(9,1).Value = nothing



我这样写代码 怎么清除不了excel的数据,这个excel 是在 浏览器控件中加载的.路径那些我都设置好的


--  作者:Bin
--  发布时间:2013/11/27 14:06:00
--  
你清除了,并不会在浏览器同步显示的.
--  作者:blackzhu
--  发布时间:2013/11/27 14:15:00
--  
问题我打开excel 也存在呀


--  作者:Bin
--  发布时间:2013/11/27 14:16:00
--  
你保存了没有?  试试赋值为 \'\'  看看
--  作者:blackzhu
--  发布时间:2013/11/27 14:17:00
--  
试过了一样  我有保存代码的
--  作者:Bin
--  发布时间:2013/11/27 14:19:00
--  
确定你试了?上个例子瞅瞅.
--  作者:blackzhu
--  发布时间:2013/11/27 14:43:00
--  
搞定了 上传代码:


If Forms("窗口1").Opened Then
    Dim exl As object = Forms("窗口1").Controls("WebBrowser1").Basecontrol.ActiveXInstance
    Dim wb As MSExcel.Workbook = exl.Document
    Dim ws As MSExcel.Worksheet= wb.worksheets("sheet1")
    ws.cells(5,3).Value = Nothing
    ws.cells(5,5).Value = Nothing
    ws.cells(6,3).Value = Nothing
    ws.cells(6,5).Value = Nothing
    ws.cells(7,3).Value = Nothing
    ws.cells(7,5).Value = Nothing
    ws.cells(8,3).Value = Nothing
    ws.cells(9,3).Value = Nothing
    ws.cells(9,5).Value = Nothing
    ws.cells(10,2).Value = Nothing
    wb.Save
End If

在这边 记住 cells 的开始行和列  全部是从1开始,而不是从0.  先行后列原则
[此贴子已经被作者于2013-11-27 14:43:48编辑过]

--  作者:blackzhu
--  发布时间:2013/11/27 14:44:00
--  
 我做了个用excel输入到数据库的东西.所以需要清除excel的输入项
--  作者:blackzhu
--  发布时间:2013/11/27 14:47:00
--  
另外一个 我在浏览器控件加载excel 怎么可以看到excel的工具栏.  foxmail的最新版是利用本地应用按钮打开的.
--  作者:blackzhu
--  发布时间:2013/11/27 15:10:00
--  
楼上的问题没有人知道吗