Nothing的使用,急等。

williamtom 2003-08-23 11:45:22
以下一段程序:
Dim xlsApp As Excel.Application
Dim xlsBook As Excel.Workbook
Dim xlsSheet As Excel.Worksheet
Dim rng1 As Excel.Range

Set xlsApp = New Excel.Application
Set xlsBook = xlsApp.Workbooks.Open("test.xls")
Set xlsSheetTemp = xlsBookTemp.Sheets(1)

Set rng1 = xlsSheet.Cells.Find(What:="VB编程技巧", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False)

现在我想判断是返回了Range对象,还是Nothing对象,该怎么判断?
...全文
40 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
drillmaster 2004-02-02
  • 打赏
  • 举报
回复
If Obj Is Nothing Then dosomething
LiaoCheng 2003-08-23
  • 打赏
  • 举报
回复
同上
射天狼 2003-08-23
  • 打赏
  • 举报
回复
If rng1 Is Nothing Then
MsgBox "返回NOTHING", vbInformation
Else
MsgBox "正确!", vbInformation
End If

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧