V
Vic Eldridge
Hi People,
I'm using the following code to produce a new MailItem in my Drafts folder.
-------------------------------------------------
Sub CreateNewEmailInDraftsFolder()
Dim objMailItem As Outlook.MailItem
Set objMailItem = Application.CreateItem(olMailItem)
With objMailItem
.To = "(e-mail address removed)"
.Subject = "Not happy Billy..."
.Body = "Dear Bill, your boy's bugs are driving me batty."
.Attachments.Add ("C:\SomeBugs4U2.exe")
.Close (olSave)
End With
Set objMailItem = Nothing
End Sub
-------------------------------------------------
This is working good except for one thing. If I navigate to my Drafts folder
and open the newly created MailItem by double-clicking on it, then I close it
without making any changes, Outlook 2003 asks if I want to save changes.
This is wrong - there were no changes made.
I've noticed that if I comment out the Attachments.Add line, everything works
as it should. But that doesn't help me much, as the app I'm working on must
have attachments.
I've also noticed that if I include the .Display method somewhere inside the
With...End With block, then everything works as it should. This however, is
not a satisfactory solution as it causes flashing on the screen as multiple
MailItems are generated.
The code seems fine to me. Is there some other trick I'm missing ?
Could someone at least confirm whether or not they see the same problem on
their system ?
Regards,
Vic Eldridge
I'm using the following code to produce a new MailItem in my Drafts folder.
-------------------------------------------------
Sub CreateNewEmailInDraftsFolder()
Dim objMailItem As Outlook.MailItem
Set objMailItem = Application.CreateItem(olMailItem)
With objMailItem
.To = "(e-mail address removed)"
.Subject = "Not happy Billy..."
.Body = "Dear Bill, your boy's bugs are driving me batty."
.Attachments.Add ("C:\SomeBugs4U2.exe")
.Close (olSave)
End With
Set objMailItem = Nothing
End Sub
-------------------------------------------------
This is working good except for one thing. If I navigate to my Drafts folder
and open the newly created MailItem by double-clicking on it, then I close it
without making any changes, Outlook 2003 asks if I want to save changes.
This is wrong - there were no changes made.
I've noticed that if I comment out the Attachments.Add line, everything works
as it should. But that doesn't help me much, as the app I'm working on must
have attachments.
I've also noticed that if I include the .Display method somewhere inside the
With...End With block, then everything works as it should. This however, is
not a satisfactory solution as it causes flashing on the screen as multiple
MailItems are generated.
The code seems fine to me. Is there some other trick I'm missing ?
Could someone at least confirm whether or not they see the same problem on
their system ?
Regards,
Vic Eldridge