excel vba outlook email

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excel VBA Outlook Email

Excel VBA Outlook Email

resolvedResolved · High Priority · Version 2007

Diane has attended:
Excel VBA Intro Intermediate course

Excel VBA Outlook Email

Hi

I have the below code to be able to email myself a confirmation of a file creation. However at the moment I have to hard code the email address.

I want whoever is the user to get that email. Is there a way you can look up the user email address based on the Outlook account set up on the computer?

Dim oApp As Object
Dim oMail As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "diane.griffiths@ondemand.co.uk"
.Subject = "Your Project Submission has been accepted"
.Body = "text"
.Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

End Sub

RE: Excel VBA Outlook Email

hi Diane

Thanks for this, I am going to have to sit down with one of my colleagues to get a reasonable idea if and how we can assist, will be back to you tomorrow.

Regards

Jacob

RE: Excel VBA Outlook Email

Hi Jacob

Thanks for your response. I've actually now come up with a solution.

Thanks though
Diane

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Page Break Preview in Excel 2010 (Hint/tip)

If you select View then Workbook Views then Page Break Preview, you will be able to view how your Excel spreadsheet will be split across multiple pages when printed. Even better, you can also drag a page break to a new place. Excel will then scale down your entire worksheet to fit the information you want on the pages you want.

View all Excel hints and tips


Server loaded in 0.08 secs.