PDA

View Full Version : Compile Error with VBA to move conversation to PST file



webharvest
01-15-2014, 06:22 PM
I'm trying to write some VBA to move the conversation I have selected in Outlook to a PST file named PSTFileName. I have the code below based on some other research but I keep getting a "Compile Error Method or data member not found" and it is erroring on the OlSelectionContents item.
Any help at all would be greatly appreciated.


Sub MoveSelectedConversationToPSTFolder(PSTFileName As String)
Set Conversations = ActiveExplorer.Selection.GetSelection(Outlook.OlSelectionContents.olConvers ationHeaders)
For Each Header In Conversations
Set Items = Header.GetItems()
For I = 1 To Items.Count
Items(I).UnRead = False
Items(I).Move PSTFileName
Next I
Next Header
End Sub

westconn1
01-17-2014, 04:14 AM
i think conversation objects are only valid in later versions of outlook

webharvest
01-19-2014, 03:04 PM
Is there a way to get the information another way? In my inbox I have my messages sorted by conversation so if I have the conversation selected is there another way in Outlook 2007 vba to select all the messages with the same subject (i.e. conversation) and move them?

westconn1
01-21-2014, 04:42 AM
if only the conversation is selected, you can move all the selected items
otherwise you should be able to use the conversationtopic of each message


Set sel = ActiveExplorer.Selection
For Each msg In sel
Debug.Print msg.ConversationTopic
msg.Move 'folder to move to
Next