WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Feed UserForm input into CustomDocumentProperties / Retrie..

 
   Home -> Office -> User Forms RSS
Next:  Bookmarks and UserForm  
Author Message
BlaBla

External


Since: Mar 04, 2008
Posts: 1



(Msg. 1) Posted: Tue Mar 04, 2008 9:31 pm
Post subject: Feed UserForm input into CustomDocumentProperties / Retrieve data from CustomDocumentProperties to reuse in Userform
Archived from groups: microsoft>public>word>vba>userforms (more info?)

I would like to use a UserForm to feed data in a Word document. I would like
users to reuse the UserForm to be able to modify data and replace the former
input. My assumption is that using the CustomDocumentProperties for storing
the input is the most appropriate solution.

Can somebody provide me an example of the VBA code for:
- Feeding input from a UserForm into CustomDocumentProperties
- Retrieving CustomDocumentProperties data to reuse in the same UserForm
(pre-fill form with "current" data)

Thanks for your help!

Tino
Back to top
Login to vote
fumei via OfficeKB.com

External


Since: Sep 21, 2007
Posts: 24



(Msg. 2) Posted: Tue Mar 04, 2008 9:31 pm
Post subject: Re: Feed UserForm input into CustomDocumentProperties / Retrieve data from CustomDocumentProperties to reuse in Userform [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

That the data is going to a userform is irrelevant. Have you looked in Help?

"My assumption is that using the CustomDocumentProperties for storing the
input is the most appropriate solution."

This may, or may not, be the most appropriate solution. It most certainly IS
an assumption. Document variables may be the most appropriate solution...who
knows?

"Can somebody provide me an example of the VBA code for:"

Help has some examples. If you have difficulties with something specific,
there are people here who can help.

In any case, you can read and write to CustomDocumentProperties.

BlaBla wrote:
>I would like to use a UserForm to feed data in a Word document. I would like
>users to reuse the UserForm to be able to modify data and replace the former
>input. My assumption is that using the CustomDocumentProperties for storing
>the input is the most appropriate solution.
>
>Can somebody provide me an example of the VBA code for:
>- Feeding input from a UserForm into CustomDocumentProperties
>- Retrieving CustomDocumentProperties data to reuse in the same UserForm
>(pre-fill form with "current" data)
>
>Thanks for your help!
>
>Tino

--
Message posted via http://www.officekb.com
Back to top
Login to vote
fumei via OfficeKB.com

External


Since: Sep 21, 2007
Posts: 24



(Msg. 3) Posted: Tue Mar 04, 2008 9:31 pm
Post subject: Re: Feed UserForm input into CustomDocumentProperties / Retrieve data from CustomDocumentProperties to reuse in Userform [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Say you had a CustomDocumentProperties named "Yadda", and it had the value
"whatever".

txtMyCustom.Text = ActiveDocument _
.CustomDocumentProperties("Yadda").Value

would put "whatever" into the textbox MyCustom

And.....it goes both ways.

ActiveDocument.CustomDocumentProperties("Yadda").Value = _
txtMyCustom.Text

So if you changed "whatever" in the textbox to "Mary had a little lamb", and
ran the above code, then the value of CustomDocumentProperty "Yadda" would be
"Mary had a little lamb".

fumei wrote:
>That the data is going to a userform is irrelevant. Have you looked in Help?
>
>"My assumption is that using the CustomDocumentProperties for storing the
>input is the most appropriate solution."
>
>This may, or may not, be the most appropriate solution. It most certainly IS
>an assumption. Document variables may be the most appropriate solution...who
>knows?
>
>"Can somebody provide me an example of the VBA code for:"
>
>Help has some examples. If you have difficulties with something specific,
>there are people here who can help.
>
>In any case, you can read and write to CustomDocumentProperties.
>
>>I would like to use a UserForm to feed data in a Word document. I would like
>>users to reuse the UserForm to be able to modify data and replace the former
>[quoted text clipped - 9 lines]
>>
>>Tino

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200803/1
Back to top
Login to vote
Doug Robbins - Word MVP

External


Since: Jul 14, 2006
Posts: 5475



(Msg. 4) Posted: Fri Mar 07, 2008 9:52 pm
Post subject: Re: Feed UserForm input into CustomDocumentProperties / Retrieve data from CustomDocumentProperties to reuse in Userform [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I would suggest that you use Document Variables instead and use {
DOCVARIABLE varname } fields in the document where you want to display the
data.

The code to store the data in the variables is:

With ActiveDocument
.Variables("varname").Value = [nameofuserformcontrol].Text
'etc
End With

To retrieve a value from a documnet variable use

[valueofthevariable] = ActiveDocument.Variables("varname").Value

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"BlaBla" <iemand.RemoveThis@microsoft.com> wrote in message
news:e9l4GbjfIHA.536@TK2MSFTNGP06.phx.gbl...
>I would like to use a UserForm to feed data in a Word document. I would
>like
> users to reuse the UserForm to be able to modify data and replace the
> former
> input. My assumption is that using the CustomDocumentProperties for
> storing
> the input is the most appropriate solution.
>
> Can somebody provide me an example of the VBA code for:
> - Feeding input from a UserForm into CustomDocumentProperties
> - Retrieving CustomDocumentProperties data to reuse in the same UserForm
> (pre-fill form with "current" data)
>
> Thanks for your help!
>
> Tino
>
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> User Forms All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET