Solved

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

Posted on 2013-01-15
3
740 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 49

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 49

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
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…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

932 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

8 Experts available now in Live!

Get 1:1 Help Now