VBScript to open Word and read registry

S

Steve Snyder

Total newbie to VB here - I want to create a script that
can read various values from a winnt/2k/xp registry, open
a Word template and populate the bookmarks in the
template. If it could write the values to an excel
worksheet upon closing Word, that'd just be serendipity!

Could anyone point me down the right road and/or give me
some idea of what I'm actually trying to do so that I can
make more educated searches for information?

Many thanks.
 
J

Jonathan West

Hi Steve,

Which version of VB are you using here - it makes a difference because
VB.NET is very different from all previous versions of VB, and VBScript has
many differences compared with the full forms of VB.

For the moment, I'll assume you are working with VBA (as embedded within
Word or Excel) and/or VB6, which share much the same syntax.

VB6/VBA has fairly limited built-in capabilities for reading the registry,
restricted to a specific corner set aside for VB users. The GetSetting and
SaveSetting commands read and write values in this area. You can look these
up in the Help file. If you need to read or write other values elsewhere in
the registry, then visit this page http://www.mvps.org/vb/samples.htm and
scroll down until you reach the RegSettings section. From there you can
download code which will allow you to read and write to anywhere in the
registry.

If you need to conrol Word from Excel or VB, then the following article
should point you in th right direction

Control Word from Excel
http://www.mvps.org/word/FAQs/InterDev/ControlWordFromXL.htm

The code should work fine from either VB or Excel.

If you then want to control Excel in order to dump the values to an Excel
worksheet, take a look at this article

Control Excel from Word
http://www.mvps.org/word/FAQs/InterDev/ControlXLFromWord.htm

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top