Thank you for your response.
I tried your code. It seems to fail on getting the current open message's
email address. I tried to comment out the
'objCustomMailForm.To = objMail.SenderEmailAddress
line to see what would happen and it opens a blank email message. Not my
form.
I also tried to add the address manually as shown below and it opens a blank
email address with the
[email protected] in the To field. So this part works
sort of.
I have used a few other bits of code to VBA'ly open my forms and it works
fine.
Eg.
'--------Sues Code------------------------
Function Item_Open()
'OPENS A CUSTOM FORM from Sue M.
Set objFolder = Application.ActiveExplorer.CurrentFolder
Set objItem = _
objFolder.Items.Add("IPM.Note.Mymessage")
objItem.Display
Item_Open = False
End Function
'--------------------------------------------------------------------
The error message I get when I run your code is
Run-time error '438':
Object doesn't support this property or method
Any thoughts?
(Its getting late Friday I may pick this up again on Monday.)
Regards
'------------ YOUR CODE --Changed Slightly by me----------------
Sub LaunchCustomFormWithPrePopulatedRecipientAddress()
Dim objMail As Outlook.MailItem, objItem As Object
Dim objCustomMailForm As Outlook.MailItem
If ActiveInspector Is Nothing Then GoTo Leave:
Set objItem = ActiveInspector.CurrentItem
If objItem.Class <> olMail Then GoTo Leave:
Set objMail = ActiveInspector.CurrentItem
Set objCustomMailForm = Application.CreateItem(olMailItem)
objCustomMailForm.MessageClass = "IPM.Note.Mymessage"
'objCustomMailForm.To = objMail.SenderEmailAddress
objCustomMailForm.To = "
[email protected]"
objCustomMailForm.Display
Leave:
Set objMail = Nothing
Set objItem = Nothing
Set objCustomMailForm = Nothing
End Sub