![]() |
In OL 07, how do you select the account to send from?
I have tried to research this and I can not find much.
Here is the code I have. It still sends from the defualt account. I have 21 email accounts and this is to be sending from the 21st account. I in the below code, I have tried using from the 3r account. Sub Mail_Selection_Range_Outlook_Body() ' Don't forget to copy the function RangetoHTML in the module. ' Working in Office 2000-2007 Dim rng As Range Dim OutApp As Object Dim OutMail As Object With Application .EnableEvents = False .ScreenUpdating = False End With Set rng = Nothing On Error Resume Next 'Only the visible cells in the selection 'Set rng = Selection.SpecialCells(xlCellTypeVisible) 'You can also use a range if you want Set rng = Sheets("Invoice").Range("B7:I47").SpecialCells(xlC ellTypeVisible) emailname = Range("M21").Value bbcname = " MsgBox emailname On Error GoTo 0 If rng Is Nothing Then MsgBox "The selection is not a range or the sheet is protected" & _ vbNewLine & "please correct and try again.", vbOKOnly Exit Sub End If Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = emailname .CC = "" .BCC = bbcname .Subject = "Invoice for - " & Range("L6").Value & " - " & Application.Text(Range("L4").Value, "mmm-dd-yyyy") .HTMLBody = RangetoHTML(rng) .Send 'or use .Display .SendUsingAccount = OutApp.Accounts(3) End With On Error GoTo 0 With Application .EnableEvents = True .ScreenUpdating = True End With Set OutMail = Nothing Set OutApp = Nothing End Sub |
In OL 07, how do you select the account to send from?
Bruce wrote:
I have tried to research this and I can not find much. Here is the code I have. Consider posting this in the programming newsgroups: microsoft.public.outlook.program_vba or microsoft.public.outlook.program_addins -- Brian Tillman |
All times are GMT +1. The time now is 08:23 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com