以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  如何获得excel选中的单元格的值  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=93825)

--  作者:jiangxun
--  发布时间:2016/12/8 2:39:00
--  如何获得excel选中的单元格的值

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).Activate

oDocument.Sheets(1).Range("A1") = "A"

上述代码,可以成功运行,但是我想获得选中的单元格,使用了selection,但是不合法

oDocument.Sheets(1).Range.selection = "A"

oDocument.Sheets(1).Rangeselection = "A"

上述两行代码都不行

如何获得选中的单元格的坐标呢?

请帮助

到哪里去获得C#.net操作excel的全部类?

 


 


--  作者:有点蓝
--  发布时间:2016/12/8 8:53:00
--  
试试

Output.Show(oDocument.Sheets(1).Range.selection.row)
Output.Show(oDocument.Sheets(1).Range.selection.column)

到哪里去获得C#.net操作excel的全部类?--网上搜索。安装vs,引入Excel组件,到类管理器查看

--  作者:有点色
--  发布时间:2016/12/8 10:48:00
--  

 微软的帮助文档好全

 

https://msdn.microsoft.com/zh-cn/library/syyd7czh(v=vs.80).aspx

 

https://msdn.microsoft.com/zh-cn/library/microsoft.office.interop.excel.aspx

 


--  作者:jiangxun
--  发布时间:2016/12/8 21:21:00
--  

还是不行啊,试了activeCell也不行,还有什么办法啊

 


--  作者:jiangxun
--  发布时间:2016/12/8 21:29:00
--  

messagebox.show(oApplication.Selection.value)

这个可以了谢谢图片点击可在新窗口打开查看