Solved

MS Outlook+Word 2010: Mail Merge from IMAP Organizational Account

Posted on 2013-01-15
3
718 Views
Last Modified: 2013-02-28
I have a mail merge template as well as excel file which we're merging the data from; these function, we've tested several times with no issues.

Our problem, however, lies in the fact that the Mail Merge mechanism sends from our personal account. We work from a large Enterprise-level organization and we need to be able to send from a organizational account ( collective_us@thisplace.com as opposed to john.doe@thisplace.com ).

I've built different profiles, I've attempted to route and forward through other accounts, I've even played with delegation. In all, the efforts have failed. Has anyone else encountered this issue, and if so, what was your solution?
0
Comment
Question by:jalongoria
  • 2
3 Comments
 
LVL 48

Expert Comment

by:Rgonzo1971
ID: 38777427
Hi,

you could use the property sendusingaccount to adapt this code

Sub SendDocumentInMail()

Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

On Error Resume Next

'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
    'Outlook wasn't running, start it from code
    Set oOutlookApp = CreateObject("Outlook.Application")
    bStarted = True
End If

'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
    'Set the recipient for the new email
   .To = "recipient@mail.com"
    'Set the recipient for a copy
    .CC = "recipient2@mail.com"
    'Set the subject
    .Subject = "New subject"
    'The content of the document is used as the body for the email
    .Body = ActiveDocument.Content
    .Send
End With

If bStarted Then
    'If we started Outlook from code, then close it
    oOutlookApp.Quit
End If

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing

End Sub

Open in new window


reference
http://msdn.microsoft.com/en-us/library/office/ff869311.aspx

Regards
0
 

Author Comment

by:jalongoria
ID: 38777859
Thanks for the insight! I had been looking through MSDN and came across that very function, but I couldn't figure out how to implement it because it seemed to be committed to POP3 versus IMAP. I'll try this method and see what happens!
0
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 38777971
Hi,

Maybe this could help to choose the account
http://social.technet.microsoft.com/Forums/en-US/outlook/thread/f6710ef7-571d-41ed-8090-a244b96e8f2c
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'MVP OShon from VBATools.pl
If Item.Class = 43 Then
Dim objMailItem As MailItem
Set objMailItem = Item

Dim olNS As Outlook.NameSpace
Set olNS = Application.GetNamespace("MAPI")

Dim wybor$, lista$, x&
For x = 1 To olNS.Accounts.Count
 lista = lista & x & " -" & olNS.Accounts.Item(x).DisplayName & vbCr
Next x

wybor = InputBox("Select the account number from the list below:" & vbCr & lista, _
 "Broadcasting from a specific account VBATools.pl", 1)

If Len(wybor) = 0 Then Cancel = True

With objMailItem
 If IsNumeric(wybor) = True Then
 if wybor > x then goto blad
 .SendUsingAccount = olNS.Accounts.Item(wybor)
 .Save
 Else
blad:
 Cancel = True
 MsgBox "Not chosen properly account number", vbExclamation, _
 "Broadcasting from a specific account VBATools.pl"
 End If
End With

Set objMailItem = Nothing
Set olNS = Nothing
End If
End Sub

Open in new window


Regards
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Get an idea of what you should include in an email disclaimer with these Top 5 email disclaimer tips.
Create high volume marketing opportunities using email signatures with these top 10 DOs and DON'Ts of email signature marketing.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now