P
Pete Davis
I have the following code:
For Each oCurrContact In oMasterFolder.Items
If False = IsInFolder(oCurrContact, oDontSendFolder) Then
oCurrContact.Copy oSendFolder
End If
Next
oCurrContact is of type ContactItem. It is a valid item and in the debugger,
it's the contact I expect it to be. oSendFolder and oMasterFolder are
MAPIFolder objects.
In the oCurrContact.Copy oSendFolder call, I get a message that "The object
does not support this method."
Now, according to the typeahead, Copy is a perfectly legitimate method in
oCurrContact. What am I doing wrong?
In case it's any help, the entire subroutine is as follows:
Dim oMAPI As Outlook.NameSpace
Dim oParentFolder As MAPIFolder
Dim oFolder As MAPIFolder
Dim oMasterFolder As MAPIFolder
Dim oDontSendFolder As MAPIFolder
Dim oSendFolder As MAPIFolder
Dim oObject As Object
Dim oCurrContact As ContactItem
If masterComboBox.Text = "" Or dontSendComboBox.Text = "" Or
sendComboBox.Text = "" Then
MsgBox "You must set all folder"
Exit Sub
End If
Set oMAPI = GetObject("", "Outlook.application").GetNamespace("MAPI")
Set oParentFolder = oMAPI.Folders("Personal Folders")
For Each oFolder In oParentFolder.Folders
If oFolder.Name = masterComboBox.Text Then
Set oMasterFolder = oFolder
ElseIf oFolder.Name = dontSendComboBox.Text Then
Set oDontSendFolder = oFolder
ElseIf oFolder.Name = sendComboBox.Text Then
Set oSendFolder = oFolder
End If
Next
For Each oCurrContact In oSendFolder.Items
oCurrContact.Delete
Next
For Each oCurrContact In oMasterFolder.Items
If False = IsInFolder(oCurrContact, oDontSendFolder) Then
oCurrContact.Copy oSendFolder
End If
Next
Thanks.
Pete
For Each oCurrContact In oMasterFolder.Items
If False = IsInFolder(oCurrContact, oDontSendFolder) Then
oCurrContact.Copy oSendFolder
End If
Next
oCurrContact is of type ContactItem. It is a valid item and in the debugger,
it's the contact I expect it to be. oSendFolder and oMasterFolder are
MAPIFolder objects.
In the oCurrContact.Copy oSendFolder call, I get a message that "The object
does not support this method."
Now, according to the typeahead, Copy is a perfectly legitimate method in
oCurrContact. What am I doing wrong?
In case it's any help, the entire subroutine is as follows:
Dim oMAPI As Outlook.NameSpace
Dim oParentFolder As MAPIFolder
Dim oFolder As MAPIFolder
Dim oMasterFolder As MAPIFolder
Dim oDontSendFolder As MAPIFolder
Dim oSendFolder As MAPIFolder
Dim oObject As Object
Dim oCurrContact As ContactItem
If masterComboBox.Text = "" Or dontSendComboBox.Text = "" Or
sendComboBox.Text = "" Then
MsgBox "You must set all folder"
Exit Sub
End If
Set oMAPI = GetObject("", "Outlook.application").GetNamespace("MAPI")
Set oParentFolder = oMAPI.Folders("Personal Folders")
For Each oFolder In oParentFolder.Folders
If oFolder.Name = masterComboBox.Text Then
Set oMasterFolder = oFolder
ElseIf oFolder.Name = dontSendComboBox.Text Then
Set oDontSendFolder = oFolder
ElseIf oFolder.Name = sendComboBox.Text Then
Set oSendFolder = oFolder
End If
Next
For Each oCurrContact In oSendFolder.Items
oCurrContact.Delete
Next
For Each oCurrContact In oMasterFolder.Items
If False = IsInFolder(oCurrContact, oDontSendFolder) Then
oCurrContact.Copy oSendFolder
End If
Next
Thanks.
Pete