UserForm1.Show : “File Not Found”

OldRookie

New Member
Joined
Nov 12, 2020
Messages
36
Office Version
  1. 2013
Platform
  1. Windows
I have some VBA code that works. I’m trying to speed up user data entry by using a Userform. It’s my first Userform and don’t know why I’m getting a “File Not Found” error message when I try to execute a “Userform1.show” command buried in my calling macro in Module1.

Userform1 has 5 option buttons and 2 command buttons. The idea is for the option buttons to assign an integer number to a public declared integer variable in Module1 depending on which button is chosen. Once chosen, the coding associated with an “OK” command button determines which option button was selected and assigns the appropriate value to the public variable in Module1. The remaining “Cancel” command button simple executes “Unload Userform1”.

After I receive the “File Not Found” error message and select “OK”, I receive a “Can’t Load or Unload This Object” error message. Upon debugging, I find the “UserForm1. Show” command highlighted in yellow. When I try to save the file, I get the “File Not Found” error message again. Selecting “OK” there numerous times to get out of an endless error loop triggers all kinds of other error messages. The long and short of it is, I can’t save this spreadsheet with all my work in it. I realize without posting lots of my code it’s hard to determine exactly what’s wrong. Some general suggestions on what to look for would be a good place to start. Any help would be greatly appreciated.

Thank you,
OldRookie
 
To all,
I really appreciate everyone’s help! My programming experience made me a firm believer in the old adage: “if you can’t debug it, don’t write it.” While I try to program in VBA with that in mind, strict adherence isn’t possible while learning. Especially with complex, extremely capable languages on systems that I’m not exactly sure of how they operate.

Norie,
I agree with your advice on changing system generated UserForm names to something more descriptive. I tried that early on, about the time things went sideways, but I’m not sure if it was related. That was my motivation for changing the UserForm name back to UserForm1. Then when that didn’t work I thought perhaps I broke a link somewhere but I’m not experienced enough to know where. Thank you for the clarification on code tags. I’ll remember to use them should the need arise.

Dave,
My study guide pointed out the difference between Name and Caption and those differences were borne out in my programming and debugging efforts. Thank you for pointing them out none the less. I understand the system’s desire to be helpful by starting a macro for me in the UserForm coding. However I would think it would only do it once like it does in the Modules. Otherwise it seems like unnecessary bloating, albeit small, needless none the less.

*Excel Max,
I think you’re question regarding other workbooks being open may certainly be addressing my original problem, part-and-parcel. Fumbling my way around and trying to save my work led to Excel offering to “fix” the problem and saving it elsewhere for recovery purposes. In addition, I tried saving it under a different name. The long and short of it is, I could have very well had a few other versions of the same thing open simultaneously with incorrect pointers. However, I didn’t knowingly have a completely different workbook open simultaneously. It seemed, until I’m more knowledgeable with UserForms, wiping the slate clean and starting over was the only way to recover. That worked well enough to move on the next UserForm problem to debug. Increasing my familiarity and understanding of UserForms is important to me; all experiences are good.

RoryA,
I didn’t use Userform_Initialize or Userform_Activate commands. I don’t where I would use them. Are they in place of UserForm1.Show? Perhaps you use them if your UserForm coding isn’t changing a Range object? Instead it’s merely changing a Global variable in the macros in the Modules? Which is where I’m now having problems.

Thanks again to all,
Cheers,
OldRookie
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I'm glad that you still learning.
That makes me motivated to help and collaborate with people.
 
Upvote 0
I didn’t use Userform_Initialize or Userform_Activate commands. I don’t where I would use them. Are they in place of UserForm1.Show?

No those are events that are triggered by loading the form and activating it (respectively). You generally use them to run code that you need to set up your form - e.g. loading data into controls, setting captions etc. If you aren't using them, then they aren't responsible for your issue! ;)
 
Upvote 0
RoryA,
Thank you for this clarification.

I was finally able to make my UserForm work as I had envisioned! Starting over was key. Small subsequent errors somehow thankfully went away, though I’m not sure why.

You and everyone else have been so helpful, I really appreciate it! It’s great to have such a valuable resource as Mr. Excel available when I hit the wall.

Many thanks to you and everyone else,
OldRookie
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

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