I guess I was using VBA, I have never programmed in Outlook always access and excel. I wrote the code and can call the macro from the Developer Tab (Marcos). I tried pasteing the code where it allows you to under the form code (View Code). I rewrote my code, it still works calling it like a marco but I can't get it to assign to my button. Help!
Public Sub CommandButton1_Click()
Set ins = Application.ActiveInspector
Set itm = ins.CurrentItem
If itm.Class <> olMail Then
MsgBox "The active Inspector is not a mail message; exiting"
' GoTo ErrorHandlerExit
'Could add more error-trapping to determine if the mail message uses a
'specific custom form, or has specific data in one or more fields
Else
Set msg = itm
' Set item = Outlook.Application.ActiveExplorer.Selection.item(1)
'Set item = Outlook.Application.ActiveInspector.CurrentItem
Set olApp = New Outlook.Application
Set olTsk = olApp.CreateItem(olTaskItem)
With olTsk
.Subject = msg.Subject
.Status = olTaskNotStarted
.Body = msg.Body
Set ups = msg.UserProperties
Set prp = ups.Find("DateDue")
If TypeName(prp) <> "Nothing" Then
If prp.Value <> #1/1/4501# Then
.DueDate = ups("DateDue").Value
End If
End If
.Save
End With
Set olTsk = Nothing
Set olApp = Nothing
End If
End Sub.
Submitted using
http://www.outlookforums.com