Userform Unload Error-Method or data member not found

SilencioDubueno

New Member
Joined
May 26, 2022
Messages
4
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hello all,
I'm fairly new to Excel VBA and am making a userform that is expected to take an entry and put it into a logged database. I'm currently having the issue of the userform crashing after being run multiple times without closing/reopening it because I don't ever unload the userform; I only clear the data inside to start a new one.
VBA Code:
Sub Reset()
NOKUserForm.Hide
NOKUserForm.CodeScan.Value = ""
NOKUserForm.CodeScan.SetFocus
NOKUserForm.Show
End Sub

I'm looking to make the Userform unload itself to clear up the memory in hopes that it will fix the issue, but I end up finding that both the Load and Unload commands return the error "Method or data member not found."
VBA Code:
NOKUserForm.Unload
'NOKUserForm.Load
'NOKUserForm.Show

Attempts to use this code or the "Unload Me" options have proven unsuccessful up to date. It pulls up the error message "Method or data member not found," and highlights the ".Load" or ".Unload" section.

Another question that may shed some light on the issue: should this code be written within the userform code itself, or in a separate module that the userform calls? I have tried putting it in a "Reset" sub as well as a part of the "Sub UserForm_Initialize" sections with no luck.

Any help is appreciated!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
There is no Unload method. It's Unload NOKUserForm.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top