Compile error with Unload frmSelectSupplier

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)
 
D

Dick Kusleika

JMMach

I don't have an answer for you, unfortunately. Try changing the line to

Unload Me

and see if you still get the error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top