userform on open + installed template = "no go"

Z

zSplash

In Word, I use a server template (which auto-installs when the form is
opened), but the use of a userform in the open_event seems to prevent the
template from running.

That is, without the userform in the open_event, the template runs just fine
after the form opens.
Even with a message box for input, the template runs just fine after the
form opens.

But, if I use a userform to get input (and then insert the input into the
form), the template does not run after the form opens. (The template is
installed and checked.)

Can someone explain this to me (and help me resolve it)?

TIA
 
D

David Sisson

Show us the code in the Open Event. Which module is it in?

How are you calling the template? File -> New, select template

or File -> Open, select template?
the template does not run after the form opens.
So, you're saying the macro starts, displays the Userform, you type in
some info into the userform, then that data is not making it to the
form?
 
Z

zSplash

Thanks for responding. No, the data makes it to the form, but the installed
addin doesn't run after the userform's input is saved to the Active
Document.

in the ThisDocument module:

Private Sub Document_New() [and, also, for Document_Open event]
userform1.Show
End Sub

in the commandBox of userform1:

Private Sub commandBox_Enter()
userform1.hide
If opt1.value=true then
ActiveDocument.FormFields("ckb1").CheckBox.Value = True
Else
ActiveDocument.FormFields("ckb1").CheckBox.Value = False
End If
End Sub

And then the installed addin should proceed to run. The installed addin, as
I said, runs great with a msgbox instead of userform1.

TIA
 
R

Russ

Does it make a difference if you hide the userform after adjusting the
formfields?
Thanks for responding. No, the data makes it to the form, but the installed
addin doesn't run after the userform's input is saved to the Active
Document.

in the ThisDocument module:

Private Sub Document_New() [and, also, for Document_Open event]
userform1.Show
End Sub

in the commandBox of userform1:

Private Sub commandBox_Enter()
userform1.hide
If opt1.value=true then
ActiveDocument.FormFields("ckb1").CheckBox.Value = True
Else
ActiveDocument.FormFields("ckb1").CheckBox.Value = False
End If
End Sub

And then the installed addin should proceed to run. The installed addin, as
I said, runs great with a msgbox instead of userform1.

TIA
David Sisson said:
Show us the code in the Open Event. Which module is it in?

How are you calling the template? File -> New, select template

or File -> Open, select template?

So, you're saying the macro starts, displays the Userform, you type in
some info into the userform, then that data is not making it to the
form?
 
Z

zSplash

Thanks, Russ. No. Immediately after getting the input, I hide the
userform.

st.

Russ said:
Does it make a difference if you hide the userform after adjusting the
formfields?
Thanks for responding. No, the data makes it to the form, but the installed
addin doesn't run after the userform's input is saved to the Active
Document.

in the ThisDocument module:

Private Sub Document_New() [and, also, for Document_Open event]
userform1.Show
End Sub

in the commandBox of userform1:

Private Sub commandBox_Enter()
userform1.hide
If opt1.value=true then
ActiveDocument.FormFields("ckb1").CheckBox.Value = True
Else
ActiveDocument.FormFields("ckb1").CheckBox.Value = False
End If
End Sub

And then the installed addin should proceed to run. The installed addin, as
I said, runs great with a msgbox instead of userform1.

TIA
David Sisson said:
Show us the code in the Open Event. Which module is it in?

How are you calling the template? File -> New, select template

or File -> Open, select template?

the template does not run after the form opens.
So, you're saying the macro starts, displays the Userform, you type in
some info into the userform, then that data is not making it to the
form?
 
R

Russ

Private Sub commandBox_Enter()
userform1.hide
If opt1.value=true then
ActiveDocument.FormFields("ckb1").CheckBox.Value = True
Else
ActiveDocument.FormFields("ckb1").CheckBox.Value = False
End If
End Sub

So you did change this to hide after the if statement?

Private Sub commandBox_Enter()
If opt1.value=true then
ActiveDocument.FormFields("ckb1").CheckBox.Value = True
Else
ActiveDocument.FormFields("ckb1").CheckBox.Value = False
End If
userform1.hide
End Sub

Thanks, Russ. No. Immediately after getting the input, I hide the
userform.

st.

Russ said:
Does it make a difference if you hide the userform after adjusting the
formfields?
Thanks for responding. No, the data makes it to the form, but the installed
addin doesn't run after the userform's input is saved to the Active
Document.

in the ThisDocument module:

Private Sub Document_New() [and, also, for Document_Open event]
userform1.Show
End Sub

in the commandBox of userform1:

Private Sub commandBox_Enter()
userform1.hide
If opt1.value=true then
ActiveDocument.FormFields("ckb1").CheckBox.Value = True
Else
ActiveDocument.FormFields("ckb1").CheckBox.Value = False
End If
End Sub

And then the installed addin should proceed to run. The installed addin, as
I said, runs great with a msgbox instead of userform1.

TIA
Show us the code in the Open Event. Which module is it in?

How are you calling the template? File -> New, select template

or File -> Open, select template?

the template does not run after the form opens.
So, you're saying the macro starts, displays the Userform, you type in
some info into the userform, then that data is not making it to the
form?
 

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