Close dialog box

W

Web_Builder

I have one dialog box with several options on it. After you fill in the
required information you hit a "Continue" button, which takes you to another
dialog box. Everything works great except the first dialog box won't close
when the second one opens. Any suggestions on how to do this. Everything I
try doesn't work!
Thanks
 
P

Patrick Molloy

without your code...

when the Continue button is clicked on, the code should
show the next form modeless, and the following code
should be the unload method...

userform1 has the button. the button, btnContinue will
show the next form, userform2...

Private Sub btnContinue_Click()
Me.Hide
UserForm2.Show vbModeless
Unload Me
End Sub


Patrick Molloy
Microsoft Excel MVP
 
W

Web_Builder

I am not using a userform (what is the advantage of doing so?) I have simply
inserted a dialog box and customized it (which has been working very well for
me so far). So from one dialog box I want to call another and close the first
one when you hit the "continue" button I have created. Here is the code for
my "continue" button.

Sub Button2_Click()

'SOLD TO
'Builder Name
Sheets("Email page").Cells(3, 2).Value =
DialogSheets("Info").EditBoxes("Edit Box 8").Text
'Builder Telephone
Sheets("Email page").Cells(4, 2).Value =
DialogSheets("Info").EditBoxes("Edit Box 9").Text
'Builder Fax
Sheets("Email page").Cells(5, 2).Value =
DialogSheets("Info").EditBoxes("Edit Box 10").Text
'Builder E-mail
Sheets("Email page").Cells(6, 2).Value =
DialogSheets("Info").EditBoxes("Edit Box 11").Text

'SHIP TO
'Street
Sheets("Email page").Cells(3, 6).Value =
DialogSheets("Info").EditBoxes("Edit Box 16").Text
'City
Sheets("Email page").Cells(4, 6).Value =
DialogSheets("Info").EditBoxes("Edit Box 19").Text
'State
Sheets("Email page").Cells(5, 6).Value =
DialogSheets("Info").EditBoxes("Edit Box 21").Text
'Zip
Sheets("Email page").Cells(5, 8).Value =
DialogSheets("Info").EditBoxes("Edit Box 23").Text
'Telephone
Sheets("Email page").Cells(6, 6).Value =
DialogSheets("Info").EditBoxes("Edit Box 25").Text


'Close Info
DialogSheets("Info").Hide
Unload DialogSheets("Info")

'Call Choice 1
DialogSheets("Choice 1").Show


End Sub

I can not get the first dialog box to close if I call the second.
 
T

Tom Ogilvy

try calling another macro with Ontime - the other macro shows the dialog

Sub Button2_Click()

'SOLD TO
'Builder Name
Sheets("Email page").Cells(3, 2).Value =
DialogSheets("Info").EditBoxes("Edit Box 8").Text
'Builder Telephone
Sheets("Email page").Cells(4, 2).Value =
DialogSheets("Info").EditBoxes("Edit Box 9").Text
'Builder Fax
Sheets("Email page").Cells(5, 2).Value =
DialogSheets("Info").EditBoxes("Edit Box 10").Text
'Builder E-mail
Sheets("Email page").Cells(6, 2).Value =
DialogSheets("Info").EditBoxes("Edit Box 11").Text

'SHIP TO
'Street
Sheets("Email page").Cells(3, 6).Value =
DialogSheets("Info").EditBoxes("Edit Box 16").Text
'City
Sheets("Email page").Cells(4, 6).Value =
DialogSheets("Info").EditBoxes("Edit Box 19").Text
'State
Sheets("Email page").Cells(5, 6).Value =
DialogSheets("Info").EditBoxes("Edit Box 21").Text
'Zip
Sheets("Email page").Cells(5, 8).Value =
DialogSheets("Info").EditBoxes("Edit Box 23").Text
'Telephone
Sheets("Email page").Cells(6, 6).Value =
DialogSheets("Info").EditBoxes("Edit Box 25").Text


'Close Info
DialogSheets("Info").Hide
Unload DialogSheets("Info")

'Call Choice 1
'DialogSheets("Choice 1").Show
Application.OnTime now, "ShowChoice"

End Sub

Private Sub ShowChoice()
DialogSheets("Choice 1").Show
End Sub
 
Top