Home | Careers | IT Counseling | IT Jobs | IT Resources

 

 

 
About Us | Advertise | Feedback | Contact Us | Bookmark this page now|
Have any doubts regarding how to Search IT Training Courses?...Click here for Quick Search Tips Search IT Courses
Have any doubts regarding Keyword Search?...Click here for Quick Search Tips keyword
Have any doubts regarding Institutes Search?...Click here for Quick Search Tips institutes
Have any doubts regarding Specialization Search?...Click here for Quick Search Tips specialization
Have any doubts regarding Fees Search?...Click here for Quick Search Tips fees
to
Have any doubts regarding Duration Search?...Click here for Quick Search Tips duration

IT dart Tips

Which IT course ?

Venture Capital

Online Education

Exams Required for US of A

Overview of Admission Process

Test Preparation

Financial Aid

TOEFEL Examination

Cool Interview Tips

Skill Check

Resume

GRE Examination

GMAT Examination


IT dart News Letter
Get ITdart.com weekly headlines before it's published on our site! Subscribe and receive the articles delivered to your inbox!

Storing variables

This is a very interesting and useful feature. On many occasions, you may want to store some values while some code runs in a document. You want these values to be usable even after the document is closed and reopened. This would normally require storing the values in a database because the VBA variables exist only in memory.

This is possible using a built-in feature of Word which allows you to define named variables and store values in them on a persistent basis. When you save the document and close it the values are also stored along with it. When you reopen the document the past values are available to you programmatically.

Here is how to do it:

There is a collection called Variables in the document object of Word. Therefore to add a new variable to it use the following syntax:

activedocument.variables.add "var name", "value"
Now if you close and reopen the file, you can retrieve the value as follows:

?activedocument.variables("nitin").value
You could also use other approaches to store values across document editing sessions:

You could use the registry using the privateprofilestring property. This method is good if the value is to be stored in a machine specific manner. If the value to be stored is specific to the document, this method is not useful.
Use Autotext entries in the word document.
Use Input/Output statements to store the values to an external text file.

One Click Courses

Advanced Certiflcate in Java Application Development

Advanced Cisco Router Conflguration

Advanced Course in Object Oriented Programming (Coop)

C#

C# with ASP.Net

CAD/ CAM

Certfication in Unix, C, C++ (CUCC)

Certificate in Advanced System Programming

Certificate in Java & E-commerce (CJEC)

EI -Strategiest

Object Oriented Developer and Designer

Specialization in 3D Graphics & Animation

Wap@Asset


Firewalls: What To Block

Windows System Architecture (WSA)

Operating System (OS)

Data Access Technologies

Functional menu-level blocking

Data Access Methodologies

ODBC Architecture

Learn Java from the ground up

Internet Security

The Day I Learnt JavaScript



ITdart Updates:
Computer Security | Computer Services | CRM | Database | E Commerce | Graphic & Design | Internet | Java | Knowledge Management | Linux | Online Marketing | Open Source | Operating System | Robotics | Semi Conductors | Software Downloads | Virus Info | WAP & 3G | Web Development | XML and Metadata
Home | Careers | IT Counseling | IT Jobs | IT Resources

© Copyright 1999-2000 ITdart.com. All rights reserved.
All brands are Trade Marks of Respective owners. Disclaimer    Legal    Privacy Policy