J
JMMach, MCSC
I need help to debug this compile error:
Excel 2000 (9.0.3821 SR-1) running in Windows 2000
I have the Userform frmSelectSupplier in one Excel file, and it works just
fine in that file.
I wanted to use the same form in another file, so I copied it by dragging
from one project to the other. Then I changed some of the properties.
But when I run the form, the form loads and I am able to select the Supplier
from the combo box but when I click on the OK button, I get the following
error:
"Microsoft Visual Basic
Compile error:
Sub or Function not defined
[ OK ] [ Help ]"
I'm stumped; I cannot figure out why this error is happening. Can anyone
shed some light on this situation?
The relavent code is below:
'in Modules:
Option Explicit
Sub SelectTheSupplier()
frmSelectSupplier.Show
End Sub
'in Forms:
Option Explicit
Private Sub UserForm_Initialize()
With cboSelectSupplier
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub
Private Sub cmdOK_Click()
Dim strSupplier As String
Dim intRow As Integer
If ActiveSheet.Name <> "P.O. Form" Then
MsgBox "The requested action cannot be performed on this sheet.",
vbOKOnly, "Terminating . . ."
End
End If
strSupplier = cboSelectSupplier.Value
ActiveSheet.Range("G19") = strSupplier
Unload frmSelectSupplier '******************** this is the problem
line. 'Unload' becomes hilighted when the macro stops **************
If cbxEditSupplier.Value = True Then
'OpenSupplierList
Sheet05.Activate 'Sup List
Do
intRow -intRow + 1
Loop Until IsEmpty(Cells(intRow, 2))
Cells(intRow, 2).Select
End If
End Sub
Private Sub cmdCancel_Click()
Unload frmSelectSupplier
End
End Sub
Any help is much appreciated.
Thanks
JMMach
(e-mail address removed)
(remove NOSPAM to get the real email address)
Excel 2000 (9.0.3821 SR-1) running in Windows 2000
I have the Userform frmSelectSupplier in one Excel file, and it works just
fine in that file.
I wanted to use the same form in another file, so I copied it by dragging
from one project to the other. Then I changed some of the properties.
But when I run the form, the form loads and I am able to select the Supplier
from the combo box but when I click on the OK button, I get the following
error:
"Microsoft Visual Basic
Compile error:
Sub or Function not defined
[ OK ] [ Help ]"
I'm stumped; I cannot figure out why this error is happening. Can anyone
shed some light on this situation?
The relavent code is below:
'in Modules:
Option Explicit
Sub SelectTheSupplier()
frmSelectSupplier.Show
End Sub
'in Forms:
Option Explicit
Private Sub UserForm_Initialize()
With cboSelectSupplier
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub
Private Sub cmdOK_Click()
Dim strSupplier As String
Dim intRow As Integer
If ActiveSheet.Name <> "P.O. Form" Then
MsgBox "The requested action cannot be performed on this sheet.",
vbOKOnly, "Terminating . . ."
End
End If
strSupplier = cboSelectSupplier.Value
ActiveSheet.Range("G19") = strSupplier
Unload frmSelectSupplier '******************** this is the problem
line. 'Unload' becomes hilighted when the macro stops **************
If cbxEditSupplier.Value = True Then
'OpenSupplierList
Sheet05.Activate 'Sup List
Do
intRow -intRow + 1
Loop Until IsEmpty(Cells(intRow, 2))
Cells(intRow, 2).Select
End If
End Sub
Private Sub cmdCancel_Click()
Unload frmSelectSupplier
End
End Sub
Any help is much appreciated.
Thanks
JMMach
(e-mail address removed)
(remove NOSPAM to get the real email address)