ffice 插件 不支持 子程序 的 关闭 主程序 打开的 excel 子程序如果对 excel 操作的话 必须 再次 打开 在关闭
UserVar lj = "c:\111.xls" "路径"
//UserVar jl_s = 100000 "记录总条数"
//hangs = Clng(jl_s)
hangs = 65000
Call 读取excel的空位置
Sub 读取excel的空位置
Call Plugin.Office.OpenXls(lj)
Do while true
text = Plugin.Office.ReadXls(1, hangs, 3)
//MessageBox text
//MessageBox hangs
If text = ""
//代表 找到了一次 第二次找没出现
If dyc_y = true
sc_hangs = hangs
hangs = dw_hangs
Call 取中间值
Else
//上次扫描的 行数
sc_hangs = hangs
hangs = hangs / 2
Call 提出整数部分
End If
Else
//找到了 值得情况
If sc_hangs - hangs <= 10 Then
Plugin.Office.CloseXls
Call 逐行查找
Exit Do
End If
Call 取中间值
dyc_y = true
End If
Loop
End Sub
MessageBox "最后的数是 :" & hangs
Sub 取中间值
//找到有值得位置了 记录有值得位置 行数到 dw_hangs 定位行数
dw_hangs = hangs
hangs = sc_hangs - dw_hangs
hangs = hangs / 2
//转换成字符串 判断是否有小数点 有的话 就 保留 整数部分
Call 提出整数部分
hangs = hangs + dw_hangs
End Sub
Sub 逐行查找
MessageBox "行数是:" & hangs & "进入逐行查找"
Call Plugin.Office.OpenXls(lj)
Do while true
text = Plugin.Office.ReadXls(1, hangs, 3)
If text <> "" Then