'运行以下程序时,需引用Excel 5.0(或9.0) Object Library
Option Explicit
Public appExcel As Excel.Application
'Public wdWorld As Excel.Workbook
Public shtWorld As Excel.WorksheetSub Run_Excel()
    Dim nRows, nCols As Long
    
    If shtWorld Is Nothing Then
         On Error Resume Next '忽略错误
         Set appExcel = GetObject(, "Excel.Application") '查找一个正在运行的 Excel 拷贝
         If Err.Number <> 0 Then '如果 Excel 没有运行则
             Set appExcel = CreateObject("Excel.Application") '运行它
             appExcel.Visible = True
             appExcel.Dialogs(xlDialogOpen).Show
         End If
         Err.Clear   ' 清除发生错误的 Err 对象
         'Set wdWorld = appExcel.ActiveWorkbook
         Set shtWorld = wdWorld.ActiveSheet
    End If
        
    With shtWorld
         nRows = .Cells(2, 1).CurrentRegion.Rows.Count
         nCols = .Cells(2, 1).CurrentRegion.Columns.Count
    End With
End Sub