PC Review


Reply
Thread Tools Rate Thread

How I auto send e-mail from excel with predefined subject and tex

 
 
=?Utf-8?B?c2R2bA==?=
Guest
Posts: n/a
 
      15th Feb 2007
i'm trying autosend e-mails from excel, but need to every time outoolk opens
already shows subject and message body. The hyperlink function is part of a
formula that provides acees to outlook
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIEphY2tzb24=?=
Guest
Posts: n/a
 
      15th Feb 2007
Modify the Ranges and Values to suit your situation.

Dim OutApp As Outlook.Application
ThisWorkbook.Activate
Dim OutMail As Outlook.MailItem
Dim strbody As String

A = Sheets("Macros").Range("C16").Value
B = Sheets("Macros").Range("C18").Value
C = Sheets("Macros").Range("A1").Value

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
strbody = "Attached is the " & C & " CSFB Activity Report." & vbNewLine
& vbNewLine & _
"Please let me know if you have any questions."
Enclosures = wbk1

IncludeAttachments = True
With OutMail
.To = A
.CC = B
.BCC = ""
.Subject = "CSFB Activity Comparison"
.Body = strbody
.Attachments.Add Workbooks(wbk1).FullName
' .Attachments.Add Workbooks(wbk2).FullName
.Display

End With

Set OutMail = Nothing
Set OutApp = Nothing
--
Best wishes,

Jim


"sdvl" wrote:

> i'm trying autosend e-mails from excel, but need to every time outoolk opens
> already shows subject and message body. The hyperlink function is part of a
> formula that provides acees to outlook

 
Reply With Quote
 
=?Utf-8?B?TmlwcHk=?=
Guest
Posts: n/a
 
      16th Feb 2007
I too would like to get a result from this; however i get a compile error:
user- defined type not defined.

Any suggestions?

"Jim Jackson" wrote:

> Modify the Ranges and Values to suit your situation.
>
> Dim OutApp As Outlook.Application
> ThisWorkbook.Activate
> Dim OutMail As Outlook.MailItem
> Dim strbody As String
>
> A = Sheets("Macros").Range("C16").Value
> B = Sheets("Macros").Range("C18").Value
> C = Sheets("Macros").Range("A1").Value
>
> Set OutApp = CreateObject("Outlook.Application")
> Set OutMail = OutApp.CreateItem(olMailItem)
> strbody = "Attached is the " & C & " CSFB Activity Report." & vbNewLine
> & vbNewLine & _
> "Please let me know if you have any questions."
> Enclosures = wbk1
>
> IncludeAttachments = True
> With OutMail
> .To = A
> .CC = B
> .BCC = ""
> .Subject = "CSFB Activity Comparison"
> .Body = strbody
> .Attachments.Add Workbooks(wbk1).FullName
> ' .Attachments.Add Workbooks(wbk2).FullName
> .Display
>
> End With
>
> Set OutMail = Nothing
> Set OutApp = Nothing
> --
> Best wishes,
>
> Jim
>
>
> "sdvl" wrote:
>
> > i'm trying autosend e-mails from excel, but need to every time outoolk opens
> > already shows subject and message body. The hyperlink function is part of a
> > formula that provides acees to outlook

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      16th Feb 2007
Select your project in the VBE
tools|References|
look for Microsoft Outlook xx.x Object Library

and check it.

Nippy wrote:
>
> I too would like to get a result from this; however i get a compile error:
> user- defined type not defined.
>
> Any suggestions?
>
> "Jim Jackson" wrote:
>
> > Modify the Ranges and Values to suit your situation.
> >
> > Dim OutApp As Outlook.Application
> > ThisWorkbook.Activate
> > Dim OutMail As Outlook.MailItem
> > Dim strbody As String
> >
> > A = Sheets("Macros").Range("C16").Value
> > B = Sheets("Macros").Range("C18").Value
> > C = Sheets("Macros").Range("A1").Value
> >
> > Set OutApp = CreateObject("Outlook.Application")
> > Set OutMail = OutApp.CreateItem(olMailItem)
> > strbody = "Attached is the " & C & " CSFB Activity Report." & vbNewLine
> > & vbNewLine & _
> > "Please let me know if you have any questions."
> > Enclosures = wbk1
> >
> > IncludeAttachments = True
> > With OutMail
> > .To = A
> > .CC = B
> > .BCC = ""
> > .Subject = "CSFB Activity Comparison"
> > .Body = strbody
> > .Attachments.Add Workbooks(wbk1).FullName
> > ' .Attachments.Add Workbooks(wbk2).FullName
> > .Display
> >
> > End With
> >
> > Set OutMail = Nothing
> > Set OutApp = Nothing
> > --
> > Best wishes,
> >
> > Jim
> >
> >
> > "sdvl" wrote:
> >
> > > i'm trying autosend e-mails from excel, but need to every time outoolk opens
> > > already shows subject and message body. The hyperlink function is part of a
> > > formula that provides acees to outlook


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?TmlwcHk=?=
Guest
Posts: n/a
 
      17th Feb 2007
Thank you, this is now working a treat.

Ideally i would like to start the body of the email with a line from the
workbook such as

Dear "name"

and then finish off with a standard signature from Outlook,

I could add the standard signature into the code but i don't get the nice
html effects i have in my signature

Any suggestions?


"Dave Peterson" wrote:

> Select your project in the VBE
> tools|References|
> look for Microsoft Outlook xx.x Object Library
>
> and check it.
>
> Nippy wrote:
> >
> > I too would like to get a result from this; however i get a compile error:
> > user- defined type not defined.
> >
> > Any suggestions?
> >
> > "Jim Jackson" wrote:
> >
> > > Modify the Ranges and Values to suit your situation.
> > >
> > > Dim OutApp As Outlook.Application
> > > ThisWorkbook.Activate
> > > Dim OutMail As Outlook.MailItem
> > > Dim strbody As String
> > >
> > > A = Sheets("Macros").Range("C16").Value
> > > B = Sheets("Macros").Range("C18").Value
> > > C = Sheets("Macros").Range("A1").Value
> > >
> > > Set OutApp = CreateObject("Outlook.Application")
> > > Set OutMail = OutApp.CreateItem(olMailItem)
> > > strbody = "Attached is the " & C & " CSFB Activity Report." & vbNewLine
> > > & vbNewLine & _
> > > "Please let me know if you have any questions."
> > > Enclosures = wbk1
> > >
> > > IncludeAttachments = True
> > > With OutMail
> > > .To = A
> > > .CC = B
> > > .BCC = ""
> > > .Subject = "CSFB Activity Comparison"
> > > .Body = strbody
> > > .Attachments.Add Workbooks(wbk1).FullName
> > > ' .Attachments.Add Workbooks(wbk2).FullName
> > > .Display
> > >
> > > End With
> > >
> > > Set OutMail = Nothing
> > > Set OutApp = Nothing
> > > --
> > > Best wishes,
> > >
> > > Jim
> > >
> > >
> > > "sdvl" wrote:
> > >
> > > > i'm trying autosend e-mails from excel, but need to every time outoolk opens
> > > > already shows subject and message body. The hyperlink function is part of a
> > > > formula that provides acees to outlook

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      17th Feb 2007
I don't. I don't use Outlook.

I'd go to Ron de Bruin's page and look through some of his sample email code.
http://www.rondebruin.nl/sendmail.htm

Nippy wrote:
>
> Thank you, this is now working a treat.
>
> Ideally i would like to start the body of the email with a line from the
> workbook such as
>
> Dear "name"
>
> and then finish off with a standard signature from Outlook,
>
> I could add the standard signature into the code but i don't get the nice
> html effects i have in my signature
>
> Any suggestions?
>
> "Dave Peterson" wrote:
>
> > Select your project in the VBE
> > tools|References|
> > look for Microsoft Outlook xx.x Object Library
> >
> > and check it.
> >
> > Nippy wrote:
> > >
> > > I too would like to get a result from this; however i get a compile error:
> > > user- defined type not defined.
> > >
> > > Any suggestions?
> > >
> > > "Jim Jackson" wrote:
> > >
> > > > Modify the Ranges and Values to suit your situation.
> > > >
> > > > Dim OutApp As Outlook.Application
> > > > ThisWorkbook.Activate
> > > > Dim OutMail As Outlook.MailItem
> > > > Dim strbody As String
> > > >
> > > > A = Sheets("Macros").Range("C16").Value
> > > > B = Sheets("Macros").Range("C18").Value
> > > > C = Sheets("Macros").Range("A1").Value
> > > >
> > > > Set OutApp = CreateObject("Outlook.Application")
> > > > Set OutMail = OutApp.CreateItem(olMailItem)
> > > > strbody = "Attached is the " & C & " CSFB Activity Report." & vbNewLine
> > > > & vbNewLine & _
> > > > "Please let me know if you have any questions."
> > > > Enclosures = wbk1
> > > >
> > > > IncludeAttachments = True
> > > > With OutMail
> > > > .To = A
> > > > .CC = B
> > > > .BCC = ""
> > > > .Subject = "CSFB Activity Comparison"
> > > > .Body = strbody
> > > > .Attachments.Add Workbooks(wbk1).FullName
> > > > ' .Attachments.Add Workbooks(wbk2).FullName
> > > > .Display
> > > >
> > > > End With
> > > >
> > > > Set OutMail = Nothing
> > > > Set OutApp = Nothing
> > > > --
> > > > Best wishes,
> > > >
> > > > Jim
> > > >
> > > >
> > > > "sdvl" wrote:
> > > >
> > > > > i'm trying autosend e-mails from excel, but need to every time outoolk opens
> > > > > already shows subject and message body. The hyperlink function is part of a
> > > > > formula that provides acees to outlook

> >
> > --
> >
> > Dave Peterson
> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
using variable in subject when send mail alvin Kuiper Microsoft Excel Programming 2 23rd May 2009 09:53 AM
my colleague send out mail with subject [spam} Ron Mazer Microsoft Outlook Discussion 1 15th Apr 2008 04:45 PM
predefined subject line with date =?Utf-8?B?ZHJpZXM=?= Microsoft Outlook VBA Programming 3 5th Feb 2007 09:54 PM
VB.NET send e-mail by Outlook using a predefined Outlook profile Newbie Microsoft Outlook Form Programming 1 2nd Sep 2006 01:06 AM
Send e-mail To, Subject, Message Bruce Microsoft Access Getting Started 8 9th Feb 2004 05:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:19 PM.