Results 1 to 2 of 2
2008-03-12, 12:27 #1
- Join Date
- Jan 2001
- Amersfoort, Netherlands
- Thanked 0 Times in 0 Posts
digitaly signing a word document (Word 2003)
I would like to create a button on a word document, so the user could sign the document and the document is send by e-mail to another user.
So I like to know what kind of information about the current user I can retreive from the system using VBA
I know how to retreive the initials en username from the properties of Word, but the user could change them
Is is possible to extract some user information from his windows login?
I will store this info in the document en show his name on the document as a digital signature.
Any sugestions are welcome.Greetings,
2008-03-12, 13:02 #2
- Join Date
- Mar 2002
- Thanked 30 Times in 30 Posts
Re: digitaly signing a word document (Word 2003)
You can use Environ("username") to get the login name, but this is not entirely dependable either since the user can change environment variables. The following code uses a Windows API function:
Private Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function WindowsUser() As String
Dim strUsername As String
strUsername = String(100, vbNullChar)
GetUserName strUsername, 100
WindowsUser = Left$(strUsername, InStr(strUsername, vbNullChar) - 1)
The declaration of GetUsername must be at the top of a module. The function can be somewhere below it.