|
-
Jun 27th, 2001, 09:18 PM
#1
Thread Starter
Hyperactive Member
How to determine if object has been set
I know I've seen this here before, but how can I determine if an object has been set or not, to avoid Error 91?
I've tried IsNull, = Nothing, etc but they don't work
I need something like:
(form level code)
Private oMyObject as CMyObject
Private Sub DoSomething()
If oMyObject (doesnt yet exist) Then Set oMyObject = New CMyObject
....
End Sub
-
Jun 27th, 2001, 11:27 PM
#2
Hyperactive Member
Try the IsEmpty command. It returns true if the variable is empty:
VB Code:
Private Sub Command1_Click()
Dim ie As Object
If IsEmpty(ie) = True Then
ie.Visible = True
Else
MsgBox "called"
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
End If
End Sub
Hope this helps.
-
Jun 28th, 2001, 12:01 AM
#3
I've alsways used Is Nothing:
Code:
If lobjObject Is Nothing then
Set lobjObject = new DummyObject
End iF
- gaffa
-
Jul 3rd, 2001, 09:47 PM
#4
Thread Starter
Hyperactive Member
Thanks to Gaffa and Reeset
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|