救助!!如何用vb将excel中的某一个数值导入窗体中的textbox中?
DimxlAppAsObjectDimxlBookAsObjectDimxlSheetAsObjectPrivateSubButton1_Click(ByValsende...
Dim xlApp As Object
Dim xlBook As Object
Dim xlSheet As Object
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
xlApp = CreateObject("Excel.Application")
TextBox1.Text = "" '将text1清空
xlApp = CreateObject("Excel.Application") '创建EXCEL对象
xlBook = xlApp.Workbooks.Open("C:\Users\znsb\Desktop\毕业设计\层次分析,模糊判断.xlsx") '打开已经存在的EXCEL工件簿文件
Textbox1.Text = xlBook.Worksheets("应用层次分析法(AHP)确定各指标权重").cells(67, 6)
xlBook.Close() '关闭excel工作簿
xlApp = Nothing '释放excel程序
系统说
Textbox1.Text = xlBook.Worksheets("应用层次分析法(AHP)确定各指标权重").cells(67, 6)
从类型“Range”到类型“String”的转换无效。怎么改一下?谢谢大神们!!! 展开
Dim xlBook As Object
Dim xlSheet As Object
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
xlApp = CreateObject("Excel.Application")
TextBox1.Text = "" '将text1清空
xlApp = CreateObject("Excel.Application") '创建EXCEL对象
xlBook = xlApp.Workbooks.Open("C:\Users\znsb\Desktop\毕业设计\层次分析,模糊判断.xlsx") '打开已经存在的EXCEL工件簿文件
Textbox1.Text = xlBook.Worksheets("应用层次分析法(AHP)确定各指标权重").cells(67, 6)
xlBook.Close() '关闭excel工作簿
xlApp = Nothing '释放excel程序
系统说
Textbox1.Text = xlBook.Worksheets("应用层次分析法(AHP)确定各指标权重").cells(67, 6)
从类型“Range”到类型“String”的转换无效。怎么改一下?谢谢大神们!!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询