A
adam
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 = (e-mail address removed)
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
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 = (e-mail address removed)
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