MailItem Modal Display Issue - Window Does Not Close on Send

G

Guest

Using the code below to create an email and bring up the email display pane.
When I click on send the email window does not close. If I set .Display
false it works fine. Is there a way to fix this issue as I need to have a
modal window.

Dim objOutlook As New Outlook.Application
Dim objMessage As Outlook._MailItem
objMessage = objOutlook.CreateItem(Outlook.OlItemType.olMailItem)
With objMessage
.To = "<email address>"
.Subject = "test"
.Body = "orange"
.Display(True) 'make it modal
End With
 
J

John Gregory

I made two slight changes and it tested fine on my OL2K
(1) I added Set before ojbMessage
(2) I did not use <> in the email address

Sub SendMailNotModal(
Dim objOutlook As New Outlook.Applicatio
Dim objMessage As Outlook.MailIte
Set objMessage = objOutlook.CreateItem(Outlook.OlItemType.olMailItem
With objMessag
.To = "(e-mail address removed)
.Subject = "test
.Body = "orange
.Display (True) 'make it moda
End Wit
End Su
 
G

Guest

Thanks for the reply, but the original code worked until the upgrade to
Office 2003. on your 2nd change the <> where just place holders. I figured
out a work around

instead of using
.Display (True) 'make it modal

I used the following:

Set ins = .GetInspector
ins.Display True
ins.Close (olDiscard)

Seems to work fine now
 

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