PDA

View Full Version : Make Userform not visible without .Hide



Liminalia
11-10-2011, 12:51 PM
Does anybody know an alternate way to hide a userform other then userform.Hide?

I am currently using a userform (frmPostProcess) that shows another userform (frmCustFunction) when a button is clicked. frmCustFunction gathers user input, and returns it back to a text control on frmPostProcess. I need the initial form to be hidden so that the presentation is still visible in the background (the initial form is decently large, but can't be made smaller).

Here is my part of my code that shows and hides the forms. It is located in a function (CustFuncDefine = boolean) called by the Click event of a button on the frmPostProcess userform.


'-- Hide parent userform
frmPostProcess.Hide

'-- Show Custom Function userform
frmCustFunction.Show
CustFuncDefine = True

'-- Show parent userform
frmPostProcess.Show


This, however, creates a nesting of active functions, because every time CustFuncDefine is run, it hits the line to show frmPostProcess, and thus never completes the function until frmPostProcess is unloaded.

I find this to be messy and likely a waste of memory, and could lead to future complications. Is there a better way to simply hide the initial form? I already tried, .Visible = False doesn't work.

Liminalia
11-15-2011, 01:41 PM
This problem isn't really PowerPoint-specific. It could be Excel or Word in the background, it doesn't really matter, it is more of a forms-specific question.

Any ideas? Or ways I could get around the problem altogether?

Thanks!

mgm05267
11-15-2011, 11:54 PM
Hi Liminalia,

Basically, MS Office user forms are being loaded within the documents.

When the forms are loaded, VBA will not allow to work on the document as they are interdependent.

In VB, MDIChild option is there... but in VBA, as per my knowledge, there is no potion to hide the main form itself...

Please let us know if you get a solution for it.

Regards,

MGM

Cosmo
11-17-2011, 06:36 AM
This, however, creates a nesting of active functions, because every time CustFuncDefine is run, it hits the line to show frmPostProcess, and thus never completes the function until frmPostProcess is unloaded.
If you set the ShowModal property of the frmPostProcess to false, it won't wait for the form to close before running the rest of the code if that's what you are looking to do.