Question : VBA to send outlook message

Hi all. I have vba in outlook to open mail messages, stip off attachments and save, and to open one excel attachment and insert data about the email(send address, data and time sent etc...). I now need to send an auto reply when the file I open has some data in it. Since I have already opened the email's inbox, can't I just use the current mapi session?? I am a bit new to vba in outlook so I am not sure. Here is my code to open the current session (I had to use GetSharedDefaultFolder because this is no my default mail). The first section of code opens the mail so I can go through each message. The second section of code is where I am TRYING to send a mail message back to someone.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
Dim ns As NameSpace
Dim Inbox As Outlook.Recipient
Dim inboxPHI As MAPIFolder
Dim SubFolder As MAPIFolder
Dim ManualFolder As MAPIFolder
Dim AppRecdFolder As MAPIFolder
Dim Item As MailItem
Dim ItemCopy As MailItem
Dim Atmt As Attachment
Dim mapiSess As MAPI.Session
Dim outbox As MAPI.Folder
 
Set ns = GetNamespace("MAPI")
 
Set Inbox = ns.CreateRecipient("email name of shared email")
Inbox.Resolve
 
Set inboxPHI = ns.GetSharedDefaultFolder(Inbox, olfolderinbox)
'open other folders for use
Set SubFolder = inboxPHI.Folders("Applications")
Set ManualFolder = inboxPHI.Folders("ApplicationsForManualReview")
Set AppRecdFolder = inboxPHI.Folders("ApplicationsReceived")
 
' section to send email
 
Set MapiMessage = ns.outbox.Messages.Add
 
With MapiMessage
' .SessionID = mapi_session.SessionID
.Compose
.RecipIndex = 0
' .RecipDisplayName = to_name
.RecipAddress = senderAdd
' .RecipType = mapToList
.RecipIndex = 1
' .RecipDisplayName = cc_name
' .RecipAddress = cc_address
' .RecipType = mapCcList
.AddressResolveUI = False
.MsgSubject = subject
.MsgNoteText = body
.Send False
End With

Answer : VBA to send outlook message

"Citrix only lets me sign on as me"
Does Citrix allow you to get to the Control Panel?  If so, then you can use the Mail applet to create another Outlook profile.
Random Solutions  
 
programming4us programming4us