D
Dave D-C
Hello,
I'm wondering about using "Set Class1Var = New Class1".
This routine needs one occurance of that statement, but it doesn't
seem to hurt to execute it millions of times. (I know I could've said
Dim Class1Var as New Class1).
Q - What's going on when I execute that statement the 2nd, 3rd, etc.
time? TIA, D-C
Dim Class1Var As Class1
Sub Sub1()
Dim iLong&
' Set Class1Var = New Class1 ' once here
For iLong = 1 To 1000000000
' Set Class1Var = New Class1 ' many times here
Set Class1Var.WithEventsImg = UserForm1.Image1
Class1Var.WithEventsImg.Tag = Format$(iLong, "000,000,000")
If iLong Mod 10000 = 0 Then ' every once in awhile
StatusBar = Class1Var.WithEventsImg.Tag
DoEvents
End If
Next iLong
End Sub
'Class1 Module for reference
'Public WithEvents WithEventsImg As MSForms.Image
'Private Sub WithEventsImg_MouseDown( _
' ByVal Button As Integer, ByVal Shift As Integer, _
' ByVal X As Single, ByVal Y As Single)
' MsgBox WithEventsImg.Tag
'End Sub
I'm wondering about using "Set Class1Var = New Class1".
This routine needs one occurance of that statement, but it doesn't
seem to hurt to execute it millions of times. (I know I could've said
Dim Class1Var as New Class1).
Q - What's going on when I execute that statement the 2nd, 3rd, etc.
time? TIA, D-C
Dim Class1Var As Class1
Sub Sub1()
Dim iLong&
' Set Class1Var = New Class1 ' once here
For iLong = 1 To 1000000000
' Set Class1Var = New Class1 ' many times here
Set Class1Var.WithEventsImg = UserForm1.Image1
Class1Var.WithEventsImg.Tag = Format$(iLong, "000,000,000")
If iLong Mod 10000 = 0 Then ' every once in awhile
StatusBar = Class1Var.WithEventsImg.Tag
DoEvents
End If
Next iLong
End Sub
'Class1 Module for reference
'Public WithEvents WithEventsImg As MSForms.Image
'Private Sub WithEventsImg_MouseDown( _
' ByVal Button As Integer, ByVal Shift As Integer, _
' ByVal X As Single, ByVal Y As Single)
' MsgBox WithEventsImg.Tag
'End Sub