Foxtable(狐表)用户栏目专家坐堂 → 我在浏览器中打开excel 连续打开一直提示文件打开需要关闭!


  共有3522人关注过本帖树形打印复制链接

主题:我在浏览器中打开excel 连续打开一直提示文件打开需要关闭!

帅哥哟,离线,有人找我吗?
blackzhu
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9879 积分:57634 威望:0 精华:15 注册:2008/9/1 9:45:00
我在浏览器中打开excel 连续打开一直提示文件打开需要关闭!  发帖心情 Post By:2014/8/22 16:07:00 [显示全部帖子]

我用这个代码执行,但是连续执行一直提示文件打开需要关闭! 我加了关闭进程也不行,加了判断文件是否打开执行关闭后 也不行,还是一直提示! 应该怎么做比较好?


Dim wbr As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")
Dim
tmp As String = ProjectPath & "Attachments\资料卡.xls"
Dim
rpt As String = ProjectPath & "Reports\资料卡.pdf"
Dim
Book As New XLS.Book(tmp)
Book
.Build()
Book
.SaveToPDF(rpt) '保存为pdf文件
wbr
.AddRess = rpt


 回到顶部
帅哥哟,离线,有人找我吗?
blackzhu
  2楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9879 积分:57634 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2014/8/22 16:42:00 [显示全部帖子]

就是呀 很奇怪 


DataTables(Vars("台账名")).LoadFilter = "台账编号='" & e.Table.Current("台账编号") & "'"
DataTables(Vars("台账名")).Load

Dim ps As  System.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("Excel")
For Each p As System.Diagnostics.Process In ps
    p.kill
Next

Dim Book As New XLS.Book(ProjectPath & "Attachments\" & Vars("台账名") & ".xls")
Dim fl As String = ProjectPath & "Reports\" & Vars("台账名") & ".xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿


If ShowAppWindow(Vars("台账名"),5) = False Then
msgbox("打开")
    Dim wbr As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")
    wbr.AddRess = ""
    wbr.AddRess = fl
End If

 这样也弹错,我看着进程关闭的


改成下面的也弹错

Dim Book As New XLS.Book(ProjectPath & "Attachments\" & Vars("台账名") & ".xls")
Dim fl As String = ProjectPath & "Reports\" & Vars("台账名") & ".xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿

Dim ps As  System.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("Excel")
For Each p As System.Diagnostics.Process In ps
    p.kill
Next

If ShowAppWindow(Vars("台账名"),5) = False Then
msgbox("打开")
    Dim wbr As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")
    wbr.AddRess = ""
    wbr.AddRess = fl
End If
[此贴子已经被作者于2014-8-22 16:45:06编辑过]

 回到顶部