Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Send mail using default client

I want to send an email with attachments using the default email client
through VBA.
My current program sends the mail using Microsoft outlook.

Is there any way through which I can send an email with an attachment using
the default email client which can be lotus notes, Netscape email client etc.

My current code goes like this:

Dim OutApp As Object
Dim OutMail As Object
Dim sh As Worksheet
Dim samp As String
With Application
..EnableEvents = False
..ScreenUpdating = False
End With
Set sh = Sheets(1)
Set OutApp = CreateObject("outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
With OutMail
..To = "
..Subject = €œSubject line€
..Attachments.Add €œC:/text.txt€
..Body = "Text in body"
..Display
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Send mail using default client

If you just want to send the attachment, then use the Sendmail command. If
you want to write a message in the body, then you might have to use CDO. See
Ron de Bruin's site:

http://www.rondebruin.nl/sendmail.htm

--
Regards,
Tom Ogilvy


"Sudeep" wrote:

I want to send an email with attachments using the default email client
through VBA.
My current program sends the mail using Microsoft outlook.

Is there any way through which I can send an email with an attachment using
the default email client which can be lotus notes, Netscape email client etc.

My current code goes like this:

Dim OutApp As Object
Dim OutMail As Object
Dim sh As Worksheet
Dim samp As String
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set sh = Sheets(1)
Set OutApp = CreateObject("outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = "
.Subject = €œSubject line€
.Attachments.Add €œC:/text.txt€
.Body = "Text in body"
.Display

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop outlook to be my default mail client Zdzislaw via OfficeKB.com New Users to Excel 2 January 2nd 11 06:43 PM
default mail client Kathy Setting up and Configuration of Excel 1 March 3rd 10 08:41 PM
Bypass: A program is trying to send mail using Item.Send prompt Vick Excel Discussion (Misc queries) 1 June 25th 09 03:31 AM
How do I set up a new default mail client? CAMS Excel Worksheet Functions 0 April 2nd 07 10:24 PM
Hyperlink - How to change default e-mail client? Kamlesh Excel Discussion (Misc queries) 4 April 11th 06 06:34 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"