Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Retrieving email addresses from nt logins

Hi Friends and Experts,

I have an Excel application in which I have already got a table of the nt
logins of the valid users which I use to validate the user. However, I would
like the application to figure out the users full name and internal e-mail
address. This is becuase the application is expected to automatically send
e-mails etc.

Is there a way I can do this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Retrieving email addresses from nt logins

Will this help?
Public Function ReturnNetworkName() As String
'RETURNS NETWORK LOGIN ID OF CURRENT USER
ReturnNetworkName = Environ("UserName")
End Function

AND:

Public Function ReturnComputerName() As String
'RETURNS COMPUTER NUMBER USER IS ON
ReturnComputerName = Environ("ComputerName")
End Function

Regards,
Ryan---

--
RyGuy


"Alok Joshi" wrote:

Hi Friends and Experts,

I have an Excel application in which I have already got a table of the nt
logins of the valid users which I use to validate the user. However, I would
like the application to figure out the users full name and internal e-mail
address. This is becuase the application is expected to automatically send
e-mails etc.

Is there a way I can do this?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Retrieving email addresses from nt logins

It might be illegal but I know it is unethical to hack into a users system to
retrieve personal information. So, if I was planning that type of set up, I
would try to make part of the log in also ask for their name and email
address. You have to be careful how you obtain information about users. I
expect to see new federal laws passed in the near future regarding such
matters because of the increases in identity theft and invasion of privacy
for things like shopping habits, internet contacts, etc. While your
intentions are honorable, your methods must also be.

"Alok Joshi" wrote:

Hi Friends and Experts,

I have an Excel application in which I have already got a table of the nt
logins of the valid users which I use to validate the user. However, I would
like the application to figure out the users full name and internal e-mail
address. This is becuase the application is expected to automatically send
e-mails etc.

Is there a way I can do this?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Retrieving email addresses from nt logins

Does your application send emails from the different users? If so, why does
it need their email address?
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Alok Joshi" wrote:

Hi Friends and Experts,

I have an Excel application in which I have already got a table of the nt
logins of the valid users which I use to validate the user. However, I would
like the application to figure out the users full name and internal e-mail
address. This is becuase the application is expected to automatically send
e-mails etc.

Is there a way I can do this?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Retrieving email addresses from nt logins

Thanks to ryguy7272, JLGWhiz and yourself for responding.

My application is an internal application for an organization where when a
user completes a task in the application, sends out an e-mail to other users
of the application that such-and-such task has been completed. There are over
50 such users. I have already built up the nt login names of the users - say
jsmith, dbarney etc. These are maintained in an access database in a shared
drive on the intranet. What I need to do is to somehow find out the full name
- programly John Smith, David Barney etc. and also the e-mail addresses of
the users so that the application can send out the e-mails.

Thanks again.

"Barb Reinhardt" wrote:

Does your application send emails from the different users? If so, why does
it need their email address?
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Alok Joshi" wrote:

Hi Friends and Experts,

I have an Excel application in which I have already got a table of the nt
logins of the valid users which I use to validate the user. However, I would
like the application to figure out the users full name and internal e-mail
address. This is becuase the application is expected to automatically send
e-mails etc.

Is there a way I can do this?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Retrieving email addresses from nt logins

Ahhh! More information is revealed. If the records are in Access, you may
want to just leave them in Access and use that app. to send emails through
Outlook. Run this code below (make appropriate modifications):
Sub SendMessages(Optional AttachmentPath)

Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String

Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("tblMailingList")
MyRS.MoveFirst

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

Do Until MyRS.EOF
' Create the e-mail message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![EmailAddress]

With objOutlookMsg
' Add the To recipients to the e-mail message.
Set objOutlookRecip = .Recipients.Add(TheAddress)
objOutlookRecip.Type = olTo

' Add the Cc recipients to the e-mail message.
If (IsNull(Forms!frmMail!CCAddress)) Then
Else
Set objOutlookRecip = .Recipients.Add(Forms!frmMail!CCAddress)
objOutlookRecip.Type = olCC
End If

' Set the Subject, the Body, and the Importance of the e-mail message.
..Subject = Forms!frmMail!Subject
..Body = Forms!frmMail!MainText
..Importance = olImportanceHigh 'High importance

' Add attachments to the message.
With Application.FileSearch
.LookIn = Forms!frmMail!Att
.FileName = "*.*"
.Execute

For i = 1 To .FoundFiles.Count
objOutlookMsg.Attachments.Add .FoundFiles(i)
Next i
End With


' Resolve the name of each Recipient.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
..Send
End With
MyRS.MoveNext
Loop
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub

Finally, install and run this (free and very practical) utility:
http://www.snapfiles.com/get/clickyes.html

Regards,
Ryan---

--
RyGuy


"Alok Joshi" wrote:

Thanks to ryguy7272, JLGWhiz and yourself for responding.

My application is an internal application for an organization where when a
user completes a task in the application, sends out an e-mail to other users
of the application that such-and-such task has been completed. There are over
50 such users. I have already built up the nt login names of the users - say
jsmith, dbarney etc. These are maintained in an access database in a shared
drive on the intranet. What I need to do is to somehow find out the full name
- programly John Smith, David Barney etc. and also the e-mail addresses of
the users so that the application can send out the e-mails.

Thanks again.

"Barb Reinhardt" wrote:

Does your application send emails from the different users? If so, why does
it need their email address?
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Alok Joshi" wrote:

Hi Friends and Experts,

I have an Excel application in which I have already got a table of the nt
logins of the valid users which I use to validate the user. However, I would
like the application to figure out the users full name and internal e-mail
address. This is becuase the application is expected to automatically send
e-mails etc.

Is there a way I can do this?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Retrieving email addresses from nt logins

It seemed to me that the OP was looking for a way to programmatically obtain
the full name and email of a user who logged onto the net. The legal way to
do that is to have authorized net users to provide the data and build a file
that the data can be retrieved from when needed. I would not want to provide
code that shows how to detect a user's email address progammatically by
accessing their mail service. While members on a network may well already
have access to the addresses, it is the publishing of the method to obtain it
that I question. Maybe I am just too cautious because I have been victimized
by identity theft.

"ryguy7272" wrote:

Ahhh! More information is revealed. If the records are in Access, you may
want to just leave them in Access and use that app. to send emails through
Outlook. Run this code below (make appropriate modifications):
Sub SendMessages(Optional AttachmentPath)

Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String

Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("tblMailingList")
MyRS.MoveFirst

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

Do Until MyRS.EOF
' Create the e-mail message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![EmailAddress]

With objOutlookMsg
' Add the To recipients to the e-mail message.
Set objOutlookRecip = .Recipients.Add(TheAddress)
objOutlookRecip.Type = olTo

' Add the Cc recipients to the e-mail message.
If (IsNull(Forms!frmMail!CCAddress)) Then
Else
Set objOutlookRecip = .Recipients.Add(Forms!frmMail!CCAddress)
objOutlookRecip.Type = olCC
End If

' Set the Subject, the Body, and the Importance of the e-mail message.
.Subject = Forms!frmMail!Subject
.Body = Forms!frmMail!MainText
.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
With Application.FileSearch
.LookIn = Forms!frmMail!Att
.FileName = "*.*"
.Execute

For i = 1 To .FoundFiles.Count
objOutlookMsg.Attachments.Add .FoundFiles(i)
Next i
End With


' Resolve the name of each Recipient.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
MyRS.MoveNext
Loop
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub

Finally, install and run this (free and very practical) utility:
http://www.snapfiles.com/get/clickyes.html

Regards,
Ryan---

--
RyGuy


"Alok Joshi" wrote:

Thanks to ryguy7272, JLGWhiz and yourself for responding.

My application is an internal application for an organization where when a
user completes a task in the application, sends out an e-mail to other users
of the application that such-and-such task has been completed. There are over
50 such users. I have already built up the nt login names of the users - say
jsmith, dbarney etc. These are maintained in an access database in a shared
drive on the intranet. What I need to do is to somehow find out the full name
- programly John Smith, David Barney etc. and also the e-mail addresses of
the users so that the application can send out the e-mails.

Thanks again.

"Barb Reinhardt" wrote:

Does your application send emails from the different users? If so, why does
it need their email address?
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Alok Joshi" wrote:

Hi Friends and Experts,

I have an Excel application in which I have already got a table of the nt
logins of the valid users which I use to validate the user. However, I would
like the application to figure out the users full name and internal e-mail
address. This is becuase the application is expected to automatically send
e-mails etc.

Is there a way I can do this?

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Retrieving email addresses from nt logins

Thanks for your very detailed response.

As JLGWhiz has mentioned I am looking for a way to find out the e-mail
addresses of other members of the same organization (something they can
easily get manually by looking up the address book in Outlook). I was just
wonding if one can get these addresses programmatically if one just knew the
NT Login of the individual users.

Thanks again to you and JLGWhiz for your responses.

"ryguy7272" wrote:

Ahhh! More information is revealed. If the records are in Access, you may
want to just leave them in Access and use that app. to send emails through
Outlook. Run this code below (make appropriate modifications):
Sub SendMessages(Optional AttachmentPath)

Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String

Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("tblMailingList")
MyRS.MoveFirst

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

Do Until MyRS.EOF
' Create the e-mail message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![EmailAddress]

With objOutlookMsg
' Add the To recipients to the e-mail message.
Set objOutlookRecip = .Recipients.Add(TheAddress)
objOutlookRecip.Type = olTo

' Add the Cc recipients to the e-mail message.
If (IsNull(Forms!frmMail!CCAddress)) Then
Else
Set objOutlookRecip = .Recipients.Add(Forms!frmMail!CCAddress)
objOutlookRecip.Type = olCC
End If

' Set the Subject, the Body, and the Importance of the e-mail message.
.Subject = Forms!frmMail!Subject
.Body = Forms!frmMail!MainText
.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
With Application.FileSearch
.LookIn = Forms!frmMail!Att
.FileName = "*.*"
.Execute

For i = 1 To .FoundFiles.Count
objOutlookMsg.Attachments.Add .FoundFiles(i)
Next i
End With


' Resolve the name of each Recipient.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
MyRS.MoveNext
Loop
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub

Finally, install and run this (free and very practical) utility:
http://www.snapfiles.com/get/clickyes.html

Regards,
Ryan---

--
RyGuy


"Alok Joshi" wrote:

Thanks to ryguy7272, JLGWhiz and yourself for responding.

My application is an internal application for an organization where when a
user completes a task in the application, sends out an e-mail to other users
of the application that such-and-such task has been completed. There are over
50 such users. I have already built up the nt login names of the users - say
jsmith, dbarney etc. These are maintained in an access database in a shared
drive on the intranet. What I need to do is to somehow find out the full name
- programly John Smith, David Barney etc. and also the e-mail addresses of
the users so that the application can send out the e-mails.

Thanks again.

"Barb Reinhardt" wrote:

Does your application send emails from the different users? If so, why does
it need their email address?
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Alok Joshi" wrote:

Hi Friends and Experts,

I have an Excel application in which I have already got a table of the nt
logins of the valid users which I use to validate the user. However, I would
like the application to figure out the users full name and internal e-mail
address. This is becuase the application is expected to automatically send
e-mails etc.

Is there a way I can do this?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Macro how to create email link for the email addresses in aRange or Selection Satish[_2_] Excel Worksheet Functions 8 December 28th 09 03:30 PM
can I copy a column of email addresses, paste into email address? Lizizfree New Users to Excel 4 July 20th 06 10:03 PM
Email addresses in Excel need to format for mass email Boomer Excel Worksheet Functions 1 June 9th 06 01:46 PM
Transfer Email addresses from spreadsheet to email address book Beana Excel Discussion (Misc queries) 2 May 30th 06 06:07 PM
send email with email addresses in a range of cells Craig[_24_] Excel Programming 1 October 10th 05 09:26 PM


All times are GMT +1. The time now is 09:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"