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 = m...@freeducation.com
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.
The data will be placed in the top of page 1 of the letter automating
input of name, department, phone no, email etc (a letterhead but not in
heders&footers).
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
Doug Robbins - Word MVP - 19 Dec 2006 18:16 GMT
See answers in microsoft.public.word.vba.general. Please do not post the
same question to multiple newsgroups.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Hello all. I'm new to this group but I really hope I can get some help.
>
[quoted text clipped - 52 lines]
> Cheers
> Adam, Sweden