![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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 |
#2
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to select the Internet account programmatically? | James | Outlook and VBA | 1 | October 30th 06 06:00 AM |
Unable to select 'account.' Fatal error occurred in Outlook | KaLynn | Outlook - Installation | 2 | August 14th 06 07:39 AM |
How to select the sending account in a CW install outlook 2000 | user | Outlook - Installation | 1 | April 22nd 06 05:22 AM |
Outlook 2003 changes the outgoing account when unable to send by selected account | HeidarV | Outlook - General Queries | 1 | January 16th 06 03:26 PM |
Outlook 2003 changes the outgoing account when unable to send by selected account | HeidarV | Outlook - General Queries | 0 | January 14th 06 09:44 AM |