Re: Runtime error 91: Object or with block variable not defined
- From: Jason Keats <jkeats@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 04 Aug 2008 19:50:55 +1000
Alex aus V wrote:
- Visual Basic 6
Hallo
after I compiled my code in an exe-file. I get everytime the error message "Runtime error 91: Object or with block variable not defined" when I call this function
Private Sub txtAltColor_Click()
Dim cmDialog As Object
On Error Resume Next
Set cmDialog = CreateObject("MSComDlg.CommonDialog")
Err.Clear
cmDialog.Color = Me.BackColor
cmDialog.CancelError = True
cmDialog.flags = cdlCCRGBInit
cmDialog.ShowColor
If Err.Number = 0 Then
txtAltColor.BackColor = cmDialog.Color
txtAltColor.Text = cmDialog.Color
Else
If Err.Number <> 32755 Then 'Abbruch aktiviert
MsgBox "Error: " & Err.Number & " : " & Err.Description
End If
End If
End Sub
The txt-field is programed on a form witch is called over a mnu_xy_click()-function from the main form.
And there in a group of variabels for a tabstrip.
I get the same error message when I put the commonDialog-object diretly on the form.
I debug enviroment I don't get any error!!??
Where must I program the defionion of the object?
Regards
If you place
Private Const cdlCCRGBInit As Long = &H1
at the top of the form containing the above code, it should work.
Perhaps your error occurs elsewhere.
HTH
.
- References:
- Runtime error 91: Object or with block variable not defined
- From: Alex aus V
- Runtime error 91: Object or with block variable not defined
- Prev by Date: Runtime error 91: Object or with block variable not defined
- Next by Date: Re: how to send 1billion characters using Winsock
- Previous by thread: Runtime error 91: Object or with block variable not defined
- Index(es):
Relevant Pages
|