Consulting

Results 1 to 4 of 4

Thread: Compile Error with VBA to move conversation to PST file

  1. #1

    Compile Error with VBA to move conversation to PST file

    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.olConversationHeaders)
        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

  2. #2
    i think conversation objects are only valid in later versions of outlook

  3. #3
    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?

  4. #4
    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •