Hello,
I am trying to set up a program that will email me when a process has been
completed by a user. The user uses a program that moves some files, after
these files are moved I want the program to also send an email that the
process has been completed.
The PC's are set up to use outlook profiles. When a user logs into our 2000
domain server through that machine, and they open outlook they are presented
with a box to chose the correct profile. If they chose their own, their
email box opens. If they chose one that is not theirs but another users they
will not be able to open outlook.
What I want this program to do is go through and open the profile of the
current logged on user. I need to assume that the outlook client will not be
open and that the program will open the program and select the correct
profile. How can this be done? I am using the following code:
SORRY FOR THE LONG MESSAGE BUT I HOPE IT CLEARS UP ANY QUESTIONS YOU MAY
HAVE. Can someone suggest a solution?
Public Function EmailMessage(DisplayMsg As Boolean, Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim objOutlookNameSpace As NameSpace
'Create the Outlook Session
Set objOutlook = CreateObject("Outlook.application")
Set objOutlookNameSpace = GetNamespace("MAPI")
objOutlookNameSpace.Logon
'Create the message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
'Add the To recipient(s) to the message
Set objOutlookRecip = .Recipients.Add("da**********@timesnews.com")
Set objOutlookRecip = .Recipients.Add("ca**********@timesnews.com")
Set objOutlookRecip = .Recipients.Add("jo*********@timesnews.com")
Set objOutlookRecip = .Recipients.Add("mi********@timesnews.com")
Set objOutlookRecip = .Recipients.Add("fr************@timesnews.com")
Set objOutlookRecip = .Recipients.Add("br********@timesnews.com")
objOutlookRecip.Type = olTo
'Set the subject, body and importance of the message
.Subject = "Burt Export " & EnterDate
.Body = "The Burt Export from PBS has been completed for " & EnterDate
.Importance = olImportanceHigh
'Resolve each Recipients name
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
'Dispaly the message before sending
If DisplayMsg Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing
End Function