J
Job
Here's the code..
Function UpdateTask()
clt_Client = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_Client2").Value
ctl_Project = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_Project").Value
ctl_ClientLead = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_ClientLead").Value
clt_TeamLead = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_TeamLead").Value
ctl_Categories = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_Categories").Value
ctl_PercentComplete = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_PctComplete").Value
ctl_Status = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_Status").Value
ctl_pmo_WBS = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("txt_WBS").Value
ctl_Subject = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("txt_Task").Value
ctl_TotalWork = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("txt_TotalWork").Value
ctl_BillRate = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("txt_BillRate").Value
ctl_Cost = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("txt_Cost").Value
'ctl_Body = Item.GetInspector.ModifiedFormPages("PM
Task")."_DocSiteControl1".Value
'ctl_Complete = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("Complete").Value
b = ItemProperties.Item(39).Value 'Owner
c = ItemProperties.Item("Subject").Value 'Subject
'msgbox a & b & c
Set olNs = Application.GetNameSpace("MAPI")
Set myRecipient = olNs.CreateRecipient(b)
myRecipient.Resolve
If myRecipient.Resolved Then
Set RemoteFolder = olNs.GetSharedDefaultFolder(myRecipient,
olFolderTasks) 'This is where the error comes in...
For i = 1 To RemoteFolder.Items.Count
Set objItem = RemoteFolder.Items(i).ItemProperties
If objItem.Item("Subject").Value = c Then
objItem.Assign
'With RemoteFolder.Items(i)
' objItem.Item("Client").Value = clt_Client
' objItem.Item("Project").Value = ctl_Project
' objItem.Item("ClientLead").Value = ctl_ClientLead
' objItem.Item("TeamLead").Value = clt_TeamLead
' objItem.Item("Categories").Value = ctl_Categories
' objItem.Item("PercentComplete").Value =
ctl_PercentComplete
' objItem.Item("Status").Value = ctl_Status
' objItem.Item("WBS").Value = ctl_pmo_WBS
' objItem.Item("Subject").Value = ctl_Subject
' objItem.Item("Total Work").Value = ctl_TotalWork
' objItem.Item("BillRate").Value = ctl_BillRate
' objItem.Item("Cost").Value = ctl_Cost
' RemoteFolder.Items(i).Save
'End With
msgbox objItem.Item("Subject").Value
End If
Next
End If
'----------------------
The error come from the line: Set RemoteFolder =
olNs.GetSharedDefaultFolder(myRecipient, olFolderTasks)
The error is "invalid procedure call or
argument:Olns.Getshareddefaultfolder..."
The point of the code is to change a task on a shared folder from another
user from the task when opened (and is the custom form). I've been able to
replicate the functionality, only using a few fields in VBA, but I wanted it
to be part of the currently opened custom for.
Any help is greatly appreciated.
Cheers
Function UpdateTask()
clt_Client = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_Client2").Value
ctl_Project = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_Project").Value
ctl_ClientLead = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_ClientLead").Value
clt_TeamLead = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_TeamLead").Value
ctl_Categories = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_Categories").Value
ctl_PercentComplete = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_PctComplete").Value
ctl_Status = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_Status").Value
ctl_pmo_WBS = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("txt_WBS").Value
ctl_Subject = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("txt_Task").Value
ctl_TotalWork = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("txt_TotalWork").Value
ctl_BillRate = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("txt_BillRate").Value
ctl_Cost = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("txt_Cost").Value
'ctl_Body = Item.GetInspector.ModifiedFormPages("PM
Task")."_DocSiteControl1".Value
'ctl_Complete = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("Complete").Value
b = ItemProperties.Item(39).Value 'Owner
c = ItemProperties.Item("Subject").Value 'Subject
'msgbox a & b & c
Set olNs = Application.GetNameSpace("MAPI")
Set myRecipient = olNs.CreateRecipient(b)
myRecipient.Resolve
If myRecipient.Resolved Then
Set RemoteFolder = olNs.GetSharedDefaultFolder(myRecipient,
olFolderTasks) 'This is where the error comes in...
For i = 1 To RemoteFolder.Items.Count
Set objItem = RemoteFolder.Items(i).ItemProperties
If objItem.Item("Subject").Value = c Then
objItem.Assign
'With RemoteFolder.Items(i)
' objItem.Item("Client").Value = clt_Client
' objItem.Item("Project").Value = ctl_Project
' objItem.Item("ClientLead").Value = ctl_ClientLead
' objItem.Item("TeamLead").Value = clt_TeamLead
' objItem.Item("Categories").Value = ctl_Categories
' objItem.Item("PercentComplete").Value =
ctl_PercentComplete
' objItem.Item("Status").Value = ctl_Status
' objItem.Item("WBS").Value = ctl_pmo_WBS
' objItem.Item("Subject").Value = ctl_Subject
' objItem.Item("Total Work").Value = ctl_TotalWork
' objItem.Item("BillRate").Value = ctl_BillRate
' objItem.Item("Cost").Value = ctl_Cost
' RemoteFolder.Items(i).Save
'End With
msgbox objItem.Item("Subject").Value
End If
Next
End If
'----------------------
The error come from the line: Set RemoteFolder =
olNs.GetSharedDefaultFolder(myRecipient, olFolderTasks)
The error is "invalid procedure call or
argument:Olns.Getshareddefaultfolder..."
The point of the code is to change a task on a shared folder from another
user from the task when opened (and is the custom form). I've been able to
replicate the functionality, only using a few fields in VBA, but I wanted it
to be part of the currently opened custom for.
Any help is greatly appreciated.
Cheers