PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming MailItem Modal Display Issue - Window Does Not Close on Send

Reply

MailItem Modal Display Issue - Window Does Not Close on Send

 
Thread Tools Rate Thread
Old 29-06-2005, 02:48 PM   #1
=?Utf-8?B?a2tyZWxsd2k=?=
Guest
 
Posts: n/a
Default MailItem Modal Display Issue - Window Does Not Close on Send


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

  Reply With Quote
Old 30-06-2005, 01:47 AM   #2
John Gregory
Guest
 
Posts: n/a
Default re:MailItem Modal Display Issue - Window Does Not Close on Send

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 = "jgregory@midsouth.rr.com
.Subject = "test
.Body = "orange
.Display (True) 'make it moda
End Wit
End Su

  Reply With Quote
Old 30-06-2005, 01:34 PM   #3
=?Utf-8?B?a2tyZWxsd2k=?=
Guest
 
Posts: n/a
Default re:MailItem Modal Display Issue - Window Does Not Close on Send

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
"John Gregory" wrote:

> 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.Application
> Dim objMessage As Outlook.MailItem
> Set objMessage = objOutlook.CreateItem(Outlook.OlItemType.olMailItem)
> With objMessage
> .To = "jgregory@midsouth.rr.com"
> .Subject = "test"
> .Body = "orange"
> .Display (True) 'make it modal
> End With
> End Sub
>
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off