PrivatePRofileString Property

D

Diamonds_Mine

I'm using the following code in Word 2003 to set the Mailing Address under
Tools, Options, User Information.

Application.UserAddress = System.PrivateProfileString("C:\Data\Office.ini", _
"Firm", "Name")

The code works properly using the *.ini file, but I need to use at least two
other key as string values including "Name". I also have "AddressLine1",
"AddressLine2" in the *.ini file that I would like to write to the Mailing
Address field. What is the syntax to add the other values so the result in
the Mailing Address field will look similar to this:

Acme, Inc.
1223 Magnolia Lane
Los Angeles, CA 90210
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?RGlhbW9uZHNfTWluZQ==?=,

If I'm understanding your question correctly, it would make sense to declare a
variable of type String to concatenate all the information, then assign that to
the Application.UserAddress property. vbCR should insert the line breaks. For
example:

Dim sAddress as String

sAddress = System.PrivateProfileString("C:\Data\Office.ini", _
"Firm", "Name") & vbCr
sAddress = sAddress & System.PrivateProfileString("C:\Data\Office.ini", _
"Firm", "AdressLine1") & vbCr
sAddress = sAddress & System.PrivateProfileString("C:\Data\Office.ini", _
"Firm", "AddressLine2")
Application.UserAddress = sAddress
I'm using the following code in Word 2003 to set the Mailing Address under
Tools, Options, User Information.

Application.UserAddress = System.PrivateProfileString("C:\Data\Office.ini", _
"Firm", "Name")

The code works properly using the *.ini file, but I need to use at least two
other key as string values including "Name". I also have "AddressLine1",
"AddressLine2" in the *.ini file that I would like to write to the Mailing
Address field. What is the syntax to add the other values so the result in
the Mailing Address field will look similar to this:

Acme, Inc.
1223 Magnolia Lane
Los Angeles, CA 90210

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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