Solved

Save a string into a Form of MS Word Document

Posted on 1999-01-04
8
169 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 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