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 / June 2007

Tip: Looking for answers? Try searching our database.

How to coding this problem!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
m2mhung - 04 Jun 2007 07:36 GMT
I created a form in MS Word and now I want to use it just by press "Show"
button.
The value of "text form fields" changed but it didn't show on the screen. I
must double click on "text form fields" which I want it show after that I
click "OK"  from the form, its value change . How can I coding this? I
attached this file for you for your ref.
Thank you.
I can't find where I can upload my file? but my code is:

Private Sub cmdShow_Click()
   'Set name
   Set stName = ActiveDocument.FormFields("txtName").TextInput
   stName.Default = txtName
 
   'Set Address
   Set stAddr = ActiveDocument.FormFields("txtAddr").TextInput
   stAddr.Default = txtAddr
 
   ' Set country
   Set stCountry = ActiveDocument.FormFields("txtCountry").TextInput
   stCountry.Default = txtCountry
   'Application.ScreenRefresh
End Sub
Susan - 04 Jun 2007 14:05 GMT
you need 2 different routines:

1.  this goes in a general module.
Private Sub cmdShow_Click()
load userform1  '<--- change to whatever your form name is
userform1.show
end sub

2.  then, in the userform module, you need an initialization sub, that
sets those values......

private sub userform1_initialize()
>     'Set name
>     Set stName = ActiveDocument.FormFields("txtName").TextInput
[quoted text clipped - 8 lines]
>     stCountry.Default = txtCountry
>     'Application.ScreenRefresh
end sub

hope it helps!
susan

>  I created a form in MS Word and now I want to use it just by press "Show"
> button.
[quoted text clipped - 19 lines]
>     'Application.ScreenRefresh
> End Sub
 
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.