怎么让VB6.0编写的程序计算出的结果输出到excel表中指定的单元格中?

比如说输出到C5格中?

首先要引用EXCELL类( Microsoft Excel 11.0 Object Library)
dim XX as string '这个是你计算出的结果,我以字符类型为例
Dim xltmp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Set xltmp = New Excel.Application
xltmp.Visible = False
Set xlBook = xltmp.Workbooks.Add
Set xlsheet = xlBook.Worksheets(1)
xlBook.Worksheets(1).Cells(5,3) =xx
xlBook.Close True
Set xlsheet = Nothing
Set xlBook = Nothing
xltmp.Quit
Set xltmp = Nothing
温馨提示:内容为网友见解,仅供参考
第1个回答  2010-06-03
实际上在EXCEL中,XX格是有坐标的,比如你说的C5格,就是.cell(5,3),即前一个参数为第几行,后一个参数为第几列。这样就可以定位了。
相似回答