Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

Set Initial Variables for Userform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
singeredel - 18 Feb 2005 20:59 GMT
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?
Signature

singeredel

Jean-Guy Marcil - 18 Feb 2005 21:54 GMT
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
[quoted text clipped - 18 lines]
> 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?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

singeredel - 19 Feb 2005 00:31 GMT
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.

> singeredel was telling us:
> singeredel nous racontait que :
[quoted text clipped - 24 lines]
> Have you set a reference to the Variables template in the VBE : Tools >
> References?
Helmut Weber - 18 Feb 2005 21:57 GMT
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/
singeredel - 19 Feb 2005 11:51 GMT
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.

> Hi,
>
[quoted text clipped - 24 lines]
> Word XP, Win 98
> http://word.mvps.org/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.