Set Initial Variables for Userform

S

singeredel

I am trying to set initial variables and bring up the Userform in Project
"Julie" from a Project named "Variables" because these initial variables
change regularly, and if I edit the variables in frmCreate_Julie_Report
manually using the VB Editor and then save the Project, I lose my digital
certificate. I attempted the following code, but I get a compile error
"method or data not found". The Variables template has been placed in the
Start folder so that it is a global template.

With Julie.frmCreate_Julie_Report
.txtReportDateMonth.Text = "02"
.txtReportDateDay.Text = "17"
.txtReportDateYear.Text = "2005"
.txtDictationDateMonth.Text = "02"
.txtDictationDateDay.Text = "17"
.txtDictationDateYear.Text = "2005"
.txtBillingPeriod.Text = "021605-022805"
.Show
End With

What is the code needed to access the Userform in the Julie Project from
another project? Are Public variables necessary at all as well?
 
J

Jean-Guy Marcil

singeredel was telling us:
singeredel nous racontait que :
I am trying to set initial variables and bring up the Userform in
Project "Julie" from a Project named "Variables" because these
initial variables change regularly, and if I edit the variables in
frmCreate_Julie_Report manually using the VB Editor and then save the
Project, I lose my digital certificate. I attempted the following
code, but I get a compile error "method or data not found". The
Variables template has been placed in the Start folder so that it is
a global template.

With Julie.frmCreate_Julie_Report
.txtReportDateMonth.Text = "02"
.txtReportDateDay.Text = "17"
.txtReportDateYear.Text = "2005"
.txtDictationDateMonth.Text = "02"
.txtDictationDateDay.Text = "17"
.txtDictationDateYear.Text = "2005"
.txtBillingPeriod.Text = "021605-022805"
.Show
End With

What is the code needed to access the Userform in the Julie Project
from another project? Are Public variables necessary at all as well?

Have you set a reference to the Variables template in the VBE : Tools >
References?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
H

Helmut Weber

Hi,

a million of unexplainable problems.

E.g. renaming Textbox2 to txt2 was essential,
otherwise Word didn't know Textbox2.

I managed it this way:

In the target project:
Sub fillin(A$, B$, C$)
Form1.Txt1.Text = A$
Form1.Txt2.Text = B$
Form1.Txt3.Text = C$
Form1.Show
End Sub

In the source project:
Sub fillformfromotherproject()
normal.fillin "A", "B", "C"
End Sub

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
S

singeredel

When I set a reference in the Variables template to the Julie template, I get
a compile error: Method or data member not found. (I am calling the userform
in the Julie template from Variables.) When I tried setting a reference in
the Julie template to Variables, I get a run-time error 424: Object required.
 
S

singeredel

This is what I have:

Target Project is Variables.Initial_Variables.Create_Report_Hannani, with a
reference to HannaniPersonal.dot, where I have:

Sub Create_Report_Hannani(txtReportDateMonth, txtReportDateDay,
txtReportDateYear, txtDictationDateMonth, txtDictationDateDay,
txtDictationDateYear, txtBillingPeriod)

With HannaniPersonalTemplate.frmCreate_Hannani_Personal
.txtReportDateMonth.Text = "02"
.txtReportDateDay.Text = "17"
.txtReportDateYear.Text = "2005"
.txtDictationDateMonth.Text = "02"
.txtDictationDateDay.Text = "17"
.txtDictationDateYear.Text = "2005"
.txtBillingPeriod.Text = "021605-022805"
.Show
End With

End Sub

Source Project is HannaniPersonalTemplate. frmCreate_Hannani_Personal, where
I have the following:

Private Sub UserForm_Initialize()

Variables.Initial_Variables.Create_Report_Hannani _
txtReportDateMonth, txtReportDateDay, txtReportDateYear, _
txtDictationDateMonth, txtDictationDateDay, txtDictationDateYear, _
txtBillingPeriod

End Sub

The Target Project doesn't even seem to be recognized, as when I try to
"run" this macro, it brings up a blank macros dialogue box with no macros
listed in it. If I try to "run" the source project, I get an "Object" error.

I am totally confused. If I place the "With--End With" code in the the same
Project as the userform itself, it runs, but not when I try to place the code
outside of the project.
 

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

Similar Threads


Top