Interaction between 2 UserForms

E

excelnut1954

There are 2 things I need help with.

1) The user lists some PO numbers to be processed within UserForm7. I
have a MsgBox in UserForm7 that tells the user during processing that
a PO# he entered was not found. I wanted to control the fonts in the
MsgBox so that it's easier to read, but I'm finding out that you
can't change the fonts of a messagebox within the macro. I know you
can other ways, but this will be used in multiple computers. An
alternative would be a UserForm.

So, I designed one (UserForm14) with just an OK button. I want the OK
button to send control back to continue the processing that was
interrupted in UserForm7. That's how it works with the MsgBox that I
currently have in UserForm7.

What code can I put in the OK button of UserForm14 to make it continue
where it left off in UserForm7. Can you switch control back like this?

'OK button in UserForm14
Private Sub CommandButton1_Click()
'OK button

End Sub

2) I put a Textbox in UserForm14 that will show the PO# that caused
the interruption in UserForm7. I tried to put an Initialize statement
in UserForm14 to show the PO# in question. But, it's not showing up.
Here's what I have in UserForm14 for TextBox1.

Private Sub UserForm_Initialize()
PONum = TextBox1
End Sub

Here's part of UserForm7 that shows how the value of PONum is set.
Dim PONum As String

Worksheets("Official List").Activate
If Me.Controls("TextBox" & i * 2 - 1).Text <> "" Then
PONum = Me.Controls("TextBox" & i * 2 - 1).Text
CountPOtoValidate = Application.CountIf(Range("J:J"), PONum)

Am I correct in thinking that PONum is the correct variable to use in
the UserForm14 Initiialize statement? Maybe a declaration statement in
UserForm14 is needed?

Any help would be appreciated, as always.
Thanks,
J.O.
 
G

Guest

1)
I would end with "Unload Me" the code triggered by the OK button on
UserForm14.
If UserForm14.Show is impemented within UserForm7 then focus should go back
on UserForm7.
2)

hard to understand, but try:

declare PONum as public in Userform7 at module level

Private Sub UserForm_Initialize()
TextBox1 = UserForm7.PONum
End Sub
 
E

excelnut1954

Thanks for the reply. I appreciate it. The problem in #1 worked fine.
I'll have to play around with #2 problem. At least it seems that using
PONum as the variable is correct.
Thanks again.
J.O.
 

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

Top