| 
 | 
 
发表于 2005-3-18 15:31:00
|
显示全部楼层
 
 
 
'定义Excel的相关变量 
                         Dim Excel As Excel.Application         'Excel对象变量 
                         Dim PointSheet As Object                                                         '点表 
                         Dim LineSheet As Object                                                                 '线表 
                         Dim ExcelWorkBook As Object                                 '工作薄 
                         Set Excel = CreateObject("Excel.Application")                 '初始化 Excel对象 
                         Set ExcelWorkBook = Excel.Workbooks.Open(txtFile, , True) 'txtFile为文件名 
                         Set PointSheet = Excel.Worksheets(1)                         '点表 
                         Set LineSheet = Excel.Worksheets(2)                                 '线表 
                         PointSheet.Activate 
                 msgbox PointSheet.Cells(1,1).Value 
                         Excel.Quit 
                         Set PointSheet = Nothing 
                         Set LineSheet = Nothing 
                         Set ExcelWorkBook = Nothing 
                         Set Excel = Nothing |   
 
 
 
 |