A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - General Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

In OL 07, how do you select the account to send from?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 1st 07, 12:48 AM posted to microsoft.public.outlook
Bruce
external usenet poster
 
Posts: 22
Default 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

  #2  
Old June 1st 07, 03:34 PM posted to microsoft.public.outlook
Brian Tillman
external usenet poster
 
Posts: 17,452
Default 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

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 08:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.