Solved

Save a string into a Form of MS Word Document

Posted on 1999-01-04
8
170 Views
Last Modified: 2010-05-03
I have a MS Word document which contain a Form for allow user to input a Directory Path.

How can I save the "Directory Path" into the Form's text box control (or somewhere) after user did the entry? So that user don't need to type the "Directory Path" again next time.

Thanks a lot.
0
Comment
Question by:st
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 4

Expert Comment

by:mcix
ID: 1453899
You may want to consider using the Variables collection of the Document Object.

Something Like this...

Private Sub Document_Open()
    Dim mstrCurrentPath As String
    ActiveDocument.Variables.Add "TEST", "SOME VALUE"
    mstrCurrentPath = ActiveDocument.Variables("TEST")
    MsgBox mstrCurrentPath
End Sub

Hopefully that will point you in a productive direction...

0
 
LVL 1

Author Comment

by:st
ID: 1453900
But.. How can I change the content of "TEST" ?
Thanks.
0
 
LVL 4

Expert Comment

by:mcix
ID: 1453901
Once you create the variable called TEST

You retrieve the value like this:
CurrentValueOfTest = ActiveDocument.Variables("TEST")

You can set the value like this:

ActiveDocument.Variables("TEST") = "Some new Value"

Does that help?

0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 1

Author Comment

by:st
ID: 1453902
Yes! Thanks a lot! But now, I got further problems about these: I can't access the variable when it is a Gobal Template.

I posted this problem as "VBA: Store & Read Variables in a Gobal Template", could you please help me to solve this further question?

Many thanks.

0
 
LVL 4

Expert Comment

by:mcix
ID: 1453903
I finally got around to answering your other question...

Sorry about the delay.


0
 
LVL 1

Author Comment

by:st
ID: 1453904
mcix, I would like to give the points and save this question with your comment. Could you please give a help? Thank you.
0
 
LVL 4

Accepted Solution

by:
mcix earned 20 total points
ID: 1453905
Did the solution work for you?
0
 
LVL 1

Author Comment

by:st
ID: 1453906
Sure! Thank you!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question