Foxtable(狐表)用户栏目专家坐堂 → 小白请教WebBrowser和excel问题


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

主题:小白请教WebBrowser和excel问题

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


加好友 发短信
等级:幼狐 帖子:159 积分:1718 威望:0 精华:0 注册:2014/9/1 0:35:00
小白请教WebBrowser和excel问题  发帖心情 Post By:2017/5/23 12:51:00 [显示全部帖子]

 Dim web As Windows.Forms.WebBrowser
web = Forms("a").Controls("WebBrowser1").baseControl
AddHandler web.DocumentCompleted,addressof WebBrowser1_DocumentCompleted
web.Navigate(Vars("PATH"))

这样打开excel后,用什么语句对他进行操作??

比如:Ws.Protect(DrawingObjects:=True)

谢谢!

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


加好友 发短信
等级:幼狐 帖子:159 积分:1718 威望:0 精华:0 注册:2014/9/1 0:35:00
  发帖心情 Post By:2017/5/23 14:19:00 [显示全部帖子]

Dim web As Windows.Forms.WebBrowser
web = Forms("a").Controls("WebBrowser1").baseControl
AddHandler web.DocumentCompleted,addressof WebBrowser1_DocumentCompleted
web.Navigate(Vars("PATH"))

Dim oDocument As object = axWebBrowser.Gettype().InvokeMember("Document", System.Reflection.BindingFlags.GetProperty, Nothing, axWebBrowser, Nothing)
Dim oApplication As object = axWebBrowser.Gettype().InvokeMember("Application", System.Reflection.BindingFlags.GetProperty, Nothing, oDocument, Nothing)
oDocument.Sheets(1).range(1).Select

这样写好像报错哦  图片点击可在新窗口打开查看



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


加好友 发短信
等级:幼狐 帖子:159 积分:1718 威望:0 精华:0 注册:2014/9/1 0:35:00
  发帖心情 Post By:2017/5/23 16:14:00 [显示全部帖子]

 再请教下啊。。如果我有两个WebBrowser打开两个excel

axWebBrowser1 = Nothing
Dim web1 As Windows.Forms.WebBrowser
web1 = e.form.Controls("WebBrowser1").baseControl
AddHandler web1.DocumentCompleted,addressof WebBrowser1_DocumentCompleted
web1.Navigate(ProjectPath & "1.xls")

Do While axWebBrowser1 Is Nothing
    Application.Doevents
Loop
Dim oDocument1 As object = axWebBrowser1.Gettype().InvokeMember("Document", System.Reflection.BindingFlags.GetProperty, Nothing, axWebBrowser1, Nothing)
Dim oApplication1 As object = axWebBrowser1.Gettype().InvokeMember("Application", System.Reflection.BindingFlags.GetProperty, Nothing, oDocument1, Nothing)
oDocument1.WorkSheets(1).range("2:2").Select




axWebBrowser2 = Nothing
Dim web2 As Windows.Forms.WebBrowser
web2 = e.form.Controls("WebBrowser2").baseControl
AddHandler web1.DocumentCompleted,addressof WebBrowser2_DocumentCompleted
web2.Navigate(ProjectPath & "2.xls")

Do While axWebBrowser2 Is Nothing
    Application.Doevents
Loop
Dim oDocument2 As object = axWebBrowser2.Gettype().InvokeMember("Document", System.Reflection.BindingFlags.GetProperty, Nothing, axWebBrowser2, Nothing)
Dim oApplication2 As object = axWebBrowser2.Gettype().InvokeMember("Application", System.Reflection.BindingFlags.GetProperty, Nothing, oDocument2, Nothing)
oDocument2.WorkSheets(1).range("2:2").Select



好像不行 图片点击可在新窗口打开查看



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


加好友 发短信
等级:幼狐 帖子:159 积分:1718 威望:0 精华:0 注册:2014/9/1 0:35:00
  发帖心情 Post By:2017/5/23 17:39:00 [显示全部帖子]

感谢!回去试试

 回到顶部