Dim Excel As New Excel.Application
Dim ExcelWBk As Workbook
Dim ExcelWS As Worksheet
'创建Excel应用程序实例
On Error Resume Next
Set Excel = GetObject(, "Excel.Application")
If Err <> 0 Then
Set Excel = CreateObject("Excel.Application")
End If
'打开工作簿
If IsNull(ExcelWBk) Then
Set ExcelWBk = Excel.Workbooks.Open("123.xls")
End If
Set ExcelWS = ExcelWBk.Sheets("点坐标") ' Add this sheet to this Workbook
Dim str As String str = ExcelWS.Cells(1, 1) '-----------------------str总是为空 Set Excel = Nothing
Dim ExcelWBk As Workbook
Dim ExcelWS As Worksheet
'创建Excel应用程序实例
On Error Resume Next
Set Excel = GetObject(, "Excel.Application")
If Err <> 0 Then
Set Excel = CreateObject("Excel.Application")
End If
'打开工作簿
If IsNull(ExcelWBk) Then
Set ExcelWBk = Excel.Workbooks.Open("123.xls")
End If
Set ExcelWS = ExcelWBk.Sheets("点坐标") ' Add this sheet to this Workbook
Dim str As String str = ExcelWS.Cells(1, 1) '-----------------------str总是为空 Set Excel = Nothing
........
On Error Resume Next
Set Excel = GetObject(, "Excel.Application")
If Err <> 0 Then
Set Excel = CreateObject("Excel.Application")
End If
On Error GoTo 0
....