Me.Show, Me.Hide, Me.Visible but no Me.Unload

TorontoJim

Board Regular
Joined
Mar 16, 2009
Messages
51
I'm using Excel 2007 on Winderz Vista at home and Excel 2003 on Winderz XP at work. I found an issue with the Object.Unload statement.

On my 2007 version, trying to use Me.Unload or userForm.Unload causes an error. It says "Method or Data Member not found".

Code:
        Me.Unload
        frmInterface.Show

Me.Hide works and Me.Show works. My problem is that the first window that shows up is Modal. The one that comes after it is Modeless. However, Excal VBA also won't allow you to show a modelss window when there is a modal window active.

Code:
        Me.Hide
        frmInterface.Show

Using Me.Hide just hides the modal window, it doesn't deactivate it.

So... being tenacious as I am and having just oodles of spare time to waste....

I found in the long run that you can use

Code:
Unload someNiftyUserForm

BUT...only if you instantiate the form using:

Code:
Load someNiftyUserForm
someNiftyUserForm.Show

I'm just sharing. Might stop someone else from beating their head on the wall.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Yes, Unload Me.

My problem was that various Internet sources showed examples and stated it was Me.Unload. This is where the confusion came in that started me (as opposed to Me) on the search.
 
Upvote 0
I found in the long run that you can use

Code:
Unload someNiftyUserForm

BUT...only if you instantiate the form using:

Code:
Load someNiftyUserForm
someNiftyUserForm.Show

Can I ask what exactly you mean by this? You do not need to use Load in order to Unload.
 
Upvote 0
In my version of Excel (2007) on WinVista, I do need to...did need to.

If I tried to Unload FormObject without using the Load FormObject it gave me an error.

I just created a test file now with two forms and of course, can not re-create this sequence. In this test file, Unload Me works without using the Load.

I went back to the original file, changed it back to the way it was and now it's working fine there as well.

I'm going back to Lion Taming. Much simpler.
 
Upvote 0
You would only get an error if you used an incorrect form name, but of course that wouldn't happen because we all use Option Explicit at the top of all our modules, don't we? ;)
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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