|
发表于 2007-2-26 23:01:00
|
显示全部楼层
提示出错?那不应该是这语句的错误吧。
给你一段测试源码,试试。
Private Sub Command1_Click()
'连接Excel
On Error Resume Next
Set xlapp = GetObject(, "Excel.Application")
If Err Then
MsgBox "没有运行的 Excel 应用程序,无法操作!", , "目标错误:"
Exit Sub
End If
xlapp.Visible = True '界面可视
AppActivate (xlapp.Caption) '显示界面
Dim xEndRow As Integer
Set xlSheet = xlapp.ActiveSheet
xEndRow = xlSheet.Cells.SpecialCells(xlCellTypeLastCell).Row '记录当前工作表最后一行有数值的行号
MsgBox xEndRow, vbInformation + vbSystemModal, "LastRow"
End Sub
nqgq2aderr1.jpg
|
|