Opening a NEW Blank Email from Excel using VBA

mattmickle

Board Regular
Joined
Nov 17, 2010
Messages
81
Hi All,
After countless hours of searching for an answer, I figured I would ask here:

I have a book that creates a unique document then prompts the user if they want to email. I'm fairly experienced at just filling in all the blanks (to, subject, body, etc.), but here's what I'm trying to do. When prompted to email, I would like to open a NEW email window, fill in everything EXCEPT the TO: field and allow the user to type the TO: themselves then send. Using my code, you never see the actual email window, it just does it...here's my code:

Sub EmailMacro()

Set srange = ActiveWorkbook.Worksheets("Email").Range("H9").Cells

For Each scount In ActiveWorkbook.Worksheets("Email").Range(srange).Cell

Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.To = ActiveWorkbook.Worksheets("Email").Range("B" & scount).Cells
myItem.Subject = ActiveWorkbook.Worksheets("Email").Range("C" & scount).Cells
myItem.Body = ActiveWorkbook.Worksheets("Email").Range("D" & scount).Cells
Set myAttachments = myItem.Attachments
myAttachments.Add "
\\depts\HR-Share\CHANGE_FORMS\" & ActiveWorkbook.Worksheets("Email").Range("F" & scount).Cells & ".pdf", _
olByValue, 1, "ok"
myItem.Send

Next

MsgBox "The Change Form has been emailed."

End Sub


Does what I'm asking make sense and is it possible?

Thanks,
Matt
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi,

I think you should change the line "myItem.Send" to "myItem.Display".
It should then display the email as far as it has been composed, instead of sending it.

Succes,

Paul
 
Upvote 0
Hi,

I think you should change the line "myItem.Send" to "myItem.Display".
It should then display the email as far as it has been composed, instead of sending it.

Succes,

Paul

Such a simple little change! I'm self taught at VBA so most of the time I feel like a bumbling idiot!
Thanks!
 
Upvote 0
You're welcome.
Thanks for the feedback.
I always use the (translated) saying: Any question, no matter how "stupid", is a sign of intelligence.


Paul
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top