Using data from an .ini file in Word
- From: adam@xxxxxxxxxxxxxxxx
- Date: 18 Dec 2006 07:43:29 -0800
Hello all. I'm new to this group but I really hope I can get some help.
I need to add data from an .ini file and insert in the document.
I've tried this:
Content of the file User.ini:
[User]
Name = my name
Mail = me@xxxxxxxxxxxxxxxx
Fax = No fax
Tel = 0706 996106
Company= Freeducation
This is my VBA code:
Sub IniValueAtBookmark()
Dim sName As String
Dim sMail As String
Dim sFax As String
Dim sTel As String
Dim sCompany As String
'Get the values
sName = System.PrivateProfileString("C:\Documents and
Settings\Adam\Mina dokument\User.ini", "User", "Name")
sMail = System.PrivateProfileString("C:\Documents and
Settings\Adam\Mina dokument\User.ini", "User", "Mail")
sFax = System.PrivateProfileString("C:\Documents and
Settings\Adam\Mina dokument\User.ini", "User", "Fax")
sTel = System.PrivateProfileString("C:\Documents and
Settings\Adam\Mina dokument\User.ini", "User", "Tel")
sCompany = System.PrivateProfileString("C:\Documents and
Settings\Adam\Mina dokument\User.ini", "User", "Company")
End Sub
I see the value of theese expressions in the "Local" window in VBA so
this far I figure I'm right.
How do place theese values into my document? Can I let Normal.dot run
the macro and then place the values into other documents with a field
or do I have to run the macro on each document?
I've tried half a day but just go into dead ends.
What I'm trying to acheive is to have a set of standard Word templates
filling in different userdata for each user in a big company.
I tried using the Custom properties that you can set in word but they
would follow the document, not the user, right?
Hope this wasn't too messy.
Cheers
Adam, Sweden
.
- Follow-Ups:
- Re: Using data from an .ini file in Word
- From: Doug Robbins - Word MVP
- RE: Using data from an .ini file in Word
- From: Anand.V.V.N
- Re: Using data from an .ini file in Word
- Prev by Date: Re: Help with Insertdatabase command
- Next by Date: Re: Help with Insertdatabase command
- Previous by thread: Re: Help with Insertdatabase command
- Next by thread: RE: Using data from an .ini file in Word
- Index(es):
Relevant Pages
|