Easy: Load sub in another form - but the new form isn't visible!

Probably quite easy, but I'm a newbie and can't get it to work...

When I call a sub in another form, like this:
     ' This is frmMain, now call
     ' a sub in frmNewFormName:
     Call frmNewFormName.subRunMe

the subRunMe-sub runs fine, but I want that frmNewFormName should be visible when running the sub... I've tried several snippets o' code to make that happen, like adding "Me.Show vbModal" in the begining of subRunMe, but then I have to close the form before the rest of the sub continues =(

Any tips?
Who is Participating?
adityauConnect With a Mentor Commented:
That's right. You have to close the modal form to continue. Why don't you use

Call frmNewFormName.subRunMe

and then say

frmNewFormName.Show vbModal

This 1st calls the procedure and then shows and it continues. Hope this helps.
What about using this one?


try this ..

Load frmNewFormName
Call frmNewFormName.subRunMe

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

cosmo3dAuthor Commented:
None of them did work :( I've tried several other "Refresh"-codes, like Me.Refresh and DoEvents, but with no success.

The solution was to show frmNewFormName from the first form with a normal frmNewFormName.Show syntax, and then use a timer on frmNewFormName with Interval:20, to call the subRunMe If Me.Visible... Kind of cumberstone - but at least it works!

If any of you have a better solution, add proposed answer. Thanks!
in the sub, couldn't you just put "FrmNewFormName.Visile = True"
and set it to false again when the sub ends?
cosmo3dAuthor Commented:
Nope. "frmNewFormName.Visible = True" won't work, as I need to display the form modally. Then, I believe "frmNewFormName.Show" is the same as "frmNewFormName.Visible" = True", so I added "frmNewFormName.Show vbModal" to the sub, but that didn't work (I've tried it before too).

What happened then was that the form had to be closed before the sub continued...
All Courses

From novice to tech pro — start learning today.