Re: copy email to a task in vba
- From: "BillyRogers" <BillyRogers@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 2 Mar 2006 11:39:31 -0800
I just figured it out.
You have to declare the variable in a standard module as public to pass it
between a form and "ThisOutlookSession"
Seems kind of strangr to have to declare it in a module that doesn't even
use it so I can pass it between two other modules.
--
Billy Rogers
Dallas,TX
Currently Using Office 2000
"Sue Mosher [MVP-Outlook]" wrote:
Perhaps the easiest approach would be to declare, in a regular code module, not ThisOutlookSession or your form's code module, a Public Outlook.MailItem object, which you could then call from the form code..
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
"BillyRogers" <BillyRogers@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:C29D4402-F1DD-43B5-8896-8EF06B4373F9@xxxxxxxxxxxxxxxx
I have some code that detects when an email is received in a folder and then
a form pops up asking the user if they want to set up a task. If they click
yes a task is created.
My problems is that I'm not sure how to get the contents of the email to the
task.
I have this code in "This outlook session" module
Public WithEvents myOlItems As Outlook.Items
Private Sub Application_Startup()
Set myOlItems = Outlook.Application.GetNamespace("MAPI").Folders("Public
Folders").Folders("All Public Folders").Folders("Company").Folders("PTI-Data
Resources").Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal item As Object)
If item.Subject = ("Merchant Report Request") Then
Load PTI_Form
PTI_Form.Show
End If
End Sub
And this code in the click event for the yes button.
Private Sub Command_Yes_Click()
Unload PTI_Form
Set NewTask = ThisOutlookSession.CreateItem(olTaskItem)
NewTask.Subject = "Ad Hoc - "
NewTask.Body = Item.Body' *******this is where the code stops*****
NewTask.Display
End Sub
I can's seem to figure out how to transfer the body property between the
modules
--
Billy Rogers
Dallas,TX
Currently Using Office 2000
- Follow-Ups:
- Re: copy email to a task in vba
- From: Michael Bauer
- Re: copy email to a task in vba
- From: Sue Mosher [MVP-Outlook]
- Re: copy email to a task in vba
- References:
- Re: copy email to a task in vba
- From: Sue Mosher [MVP-Outlook]
- Re: copy email to a task in vba
- Prev by Date: Re: copy email to a task in vba
- Next by Date: Outlook COM Addin and Redemption
- Previous by thread: Re: copy email to a task in vba
- Next by thread: Re: copy email to a task in vba
- Index(es):