Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA - Editing a UserDefined Property in an Outlook Task

Status
Not open for further replies.

ajhess

Technical User
Jul 27, 2012
18
US
I have a user-defined property in my Outlook Tasks called "Priority". When I create a new task, I would like to have a button that calls a macro where I can input my custom priority (1, 2, 3, etc...).

I think I need to use .UserProperties("Priority"), but I'm having trouble setting the macro to the currently selected task...

Any help would be great, thank you!
 
Selected as the active item... I would like to create a new task, and from that window hit a macro button to assign user-defined priority
 
This is what I have so far... I'm trying to run it from a button in a new task window. It produces an error "Object variable or With block variable not set".
I'm new to macros... please be kind :)

Sub taskUserPriority()

Dim objTask As Outlook.TaskItem
Dim Priority As String
Priority = InputBox("P1 - P5 Or Monthly")
objTask.UserProperties("Priority") = Priority

End Sub
 
To get the taskobject for the task in the "active window"

activeinspector.CurrentItem

So, something like

Dim MyItem as Object
Set MyItem = ActiveInspector.CurrentItem
MyItem.UserProperties("Priority") = "Nuclear"



 
Thanks mintjulep! this is what ended up working for me... appreciate the help!

Dim objTask As Object
Set objTask = ActiveInspector.CurrentItem
Dim objProperty As Outlook.UserProperty
Set objProperty = objTask.UserProperties.Add("Priority ", Outlook.OlUserPropertyType.olText)


Dim Priority As String
Priority = InputBox("P1 - P5 Or Monthly")
objProperty.Value = Priority
'objTask.Save
'objTask.Close olSave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top