How do I hide the form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form, "form a" which is called by a Function in a Sub, "Sub1".
I also have a form, "form b", called by a Sub, "Sub2".

"form b" calls "Sub1" which, in turn, calls "form a." After I unload "form
a," "form b" comes to the front and "form a" remains visible in back of "form
b". I want "form a" to diappear after it is unloaded. How do I do this?

ShowModal is true for both forms.

Thanks
 
Do you really unload it, or just re-show the other? If you unload it, it
should go.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
I am including the following Code sniippets. I hope this will shed some light.

Calls the Sub:

intTextLen = Len(Sheets("Data").Range("B3").Value)
Do While intTextLen = 0
z = MsgBox("At least one legend is required." & Chr$(13) &
Chr$(10) & _
"Do you wish to enter legends now?", vbYesNo)
If z = vbYes Then
Call CreateLegends <--------- name of sub
Else
MsgBox "You have chosen not to enter any legends." &
Chr$(13) & Chr$(10) & _
"A web page cannot be generated." & Chr$(13) & Chr$(10)
& _
"This form will close."
ActiveCell.Value = "Cancelled"
intTextLen = 1
boolButton = True
Range("A3").Activate
Unload Me
End If
Loop

From form "a":

Private Sub AddButton_Click()
If Len(LegendTitle.Value) = 0 Then
MsgBox "Please enter a Legend Title for this color."
LegendTitle.SetFocus
Else
Range("E2").Value = Range("E2").Value + 1
ActiveCell.Interior.Pattern = xlSolid
ActiveCell.Value = "Legend" & Range("E2").Value
ActiveCell.Offset(0, 1).Activate
ActiveCell.Value = LegendTitle.Value
ActiveCell.Offset(0, -1).Activate
z = setColor()
strUsed = Range("D2").Value
Range("D2").Value = strUsed & strSelected
boolButton = True
Unload ColorForm <------------- form remains visible
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top