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

excel vba outlook email

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

Excel VBA Outlook Email

ResolvedVersion 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:

Cycling through Absoulte cell references

If you are working with formulas in excel and need to convert your formula to an absolute formula, instead on manually adding in the $dollar signs you can highlight the specific part of your formula and press the F4 key.

You can cycle through all the absolute options by pressing the button (up to four times)

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.