Creating but not sending an e-mail from Word

S

Steve Lang

Hi all,

I want to be able to create an email with an attachment but have it appear
on the screen so the user can add text to the body, subject, etc. before
manually sending it. I have used the following code in the past to
automatically send a message, but I don't know what to change to keep it
active on the screen so it can accept user input.

Dim strPSFile As String
Dim myOutlook As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myItem As Object


'create instance of Outlook and attach the file to the created e-mail
On Error GoTo trap
Set myOutlook = CreateObject("Outlook.Application")
Set myNameSpace = myOutlook.GetNamespace("MAPI")
Set myItem = myOutlook.CreateItem(olMailItem)
With myItem
.To = "slang"
.Subject = "Test Message"
.Body = ""
.Attachments.Add PDFOutPath & strPDFFile
.Send
End With
Set myItem = Nothing
Set myNameSpace = Nothing
Set myOutlook = Nothing
Exit Function


TIA and have a great day!
--
Stephen Lang
Legislative Counsel Bureau
Carson City, NV
GMT+8
slang at lcb <-dot> state <dot-> nv <d-ot> us
 
S

Sue Mosher [MVP]

Simply replace Send with Display.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
S

Steve Lang

To quote the inestimably erudite Homer Simpson: "Doh!"

Thanks, Sue!


Simply replace Send with Display.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top