Solved

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

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
Find out what you should include to make the best professional email signature for your organization.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

808 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