Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Send Email from VBA

How or can I setup the body of an email to have more than one line?
Can I open a template? How?
'======
With oMailItem
.Subject = "The extract has finished."
.Body = "This is an automatic email notification"
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Send Email from VBA

Original Code: (Thx Bob Phillips):
How do I get rid of the security prompt? (it comes up two times?).

'======
Private Sub CommandButton2_Click()
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object


Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True


Set oMailItem = oOutlook.CreateItem(0)
Set oRecipient = _
om")
oRecipient.Type = 1 '1 = To, use 2 for cc
'keep repeating these lines with
'your names, adding to the collection.
With oMailItem
.Subject = "This is an automatic email notification: Bad Link
from SPEC INDEX Excel File!"
.body = "(Please enter the ""Spec Name"", ""Worksheet Name"" and
""Cell Address"" and a brief description of the problem!)"
' .Attachments.Add ("filename") 'you only need this if
'you are sending attachments?
.Display 'use .Send when all testing done
End With

Set oRecipient = Nothing
Set oMailItem = Nothing
Set oNameSpace = Nothing
Set oOutlook = Nothing
End Sub
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007



"Rick S." wrote:

How or can I setup the body of an email to have more than one line?
Can I open a template? How?
'======
With oMailItem
.Subject = "The extract has finished."
.Body = "This is an automatic email notification"
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Send Email from VBA

You could try

.Body = "This is line 1" & vbcr & "This is line 2"



HTH,
JP

On Jan 10, 3:09*pm, Rick S. wrote:
How or can I setup the body of an email to have more than one line?
Can I open a template? How?
'======
* * * * With oMailItem
* * * * * * .Subject = "The extract has finished."
* * * * * * .Body = "This is an automatic email notification"
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Send Email from VBA

See
http://www.rondebruin.nl/mail/prevent.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Rick S." wrote in message ...
Original Code: (Thx Bob Phillips):
How do I get rid of the security prompt? (it comes up two times?).

'======
Private Sub CommandButton2_Click()
Dim oOutlook As Object
Dim oMailItem As Object
Dim oRecipient As Object
Dim oNameSpace As Object


Set oOutlook = CreateObject("Outlook.Application")
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True


Set oMailItem = oOutlook.CreateItem(0)
Set oRecipient = _
om")
oRecipient.Type = 1 '1 = To, use 2 for cc
'keep repeating these lines with
'your names, adding to the collection.
With oMailItem
.Subject = "This is an automatic email notification: Bad Link
from SPEC INDEX Excel File!"
.body = "(Please enter the ""Spec Name"", ""Worksheet Name"" and
""Cell Address"" and a brief description of the problem!)"
' .Attachments.Add ("filename") 'you only need this if
'you are sending attachments?
.Display 'use .Send when all testing done
End With

Set oRecipient = Nothing
Set oMailItem = Nothing
Set oNameSpace = Nothing
Set oOutlook = Nothing
End Sub
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007



"Rick S." wrote:

How or can I setup the body of an email to have more than one line?
Can I open a template? How?
'======
With oMailItem
.Subject = "The extract has finished."
.Body = "This is an automatic email notification"
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Send Email from VBA

JP, Ron thanks!
Is there a way to send the cursor to a specific place in the email?
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007



"JP" wrote:

You could try

.Body = "This is line 1" & vbcr & "This is line 2"



HTH,
JP

On Jan 10, 3:09 pm, Rick S. wrote:
How or can I setup the body of an email to have more than one line?
Can I open a template? How?
'======
With oMailItem
.Subject = "The extract has finished."
.Body = "This is an automatic email notification"
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Send Email from VBA

What are you trying to do?


--JP

On Jan 10, 4:16*pm, Rick S. wrote:
JP, Ron thanks!
Is there a way to send the cursor to a specific place in the email?
--
Regards


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Send Email from VBA

I have created what is called a "Live Document" (Excel). it contains
specifications that are interlinked to superseding and or current
specifications.
When a user finds a dead or bad link (hyperlink and or link to named cells
from user forms) there is a command button to send an email. The email will
provide information to me of where, when and what specification is not
functioning properly.

With your and Ron's help (email side) I now have an email opened with a body
of text to auto fill. Only odd characteristic of this, is, the cursor is at
the beginning of the email (top left corner).

No biggie tho, I do appreciate the help I have received. ;)
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007



"JP" wrote:

What are you trying to do?


--JP

On Jan 10, 4:16 pm, Rick S. wrote:
JP, Ron thanks!
Is there a way to send the cursor to a specific place in the email?
--
Regards



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Send Email from VBA

You're welcome!

ps- I don't believe there is a way you can place the cursor anywhere
else.


--JP


On Jan 10, 4:56*pm, Rick S. wrote:
I have created what is called a "Live Document" (Excel). *it contains
specifications that are interlinked to superseding and or current
specifications.
When a user finds a dead or bad link (hyperlink and or link to named cells
from user forms) there is a command button to send an email. *The email will
provide information to me of where, when and what specification is not
functioning properly.

With your and Ron's help (email side) I now have an email opened with a body
of text to auto fill. *Only odd characteristic of this, is, the cursor is at
the beginning of the email (top left corner).

No biggie tho, I do appreciate the help I have received. ;)
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007


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
send email to each customer email in excel sheet. -keevill- Excel Discussion (Misc queries) 3 July 17th 08 02:33 PM
Send data from Excel in email from specific email address Erik Excel Programming 5 December 5th 07 05:09 PM
send wkbk as an email attachment with an email address copied from SueInAtl Excel Discussion (Misc queries) 0 May 21st 07 10:53 PM
send email with email addresses in a range of cells Craig[_24_] Excel Programming 1 October 10th 05 09:26 PM
body of email disappears when I send an email from Excel ~A Excel Discussion (Misc queries) 0 February 25th 05 10:55 PM


All times are GMT +1. The time now is 10:29 AM.

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

About Us

"It's about Microsoft Excel"