none
Outlook 2003 VBA - AdvancedSearch in a personal folder (*.pst data file)

    Question

  • Hello,

    I'm trying to create a searchfolder in a personal folder (*.pst data file). But I don't know how to create them. I have used the advancedsearch method but it looks like as this method can only be used in the current email account and not in a *.pst data file.

    this is my code to create a searchfolder object in the current email account:


    Private Sub Demo()

        Dim objSearch As Search
        
        Const strWhat As String = "urn:schemas:mailheader:subject = 'Test'"
        Const strWhere As String = "Inbox"
       
        Set objSearch = Application.AdvancedSearch(strWhere, strWhat)
        objSearch.Save "Demo"

    End Sub

     


    Now I have tried to change to constant 'strWhere' to search in a *.pst data file like this:


    strWhere = "\\Archive_2005"
    strWhere = "Archive_2005"
    strWhere = "P:\Outlook\Archive_2005.pst"  'original path

     


    In each above cases I have received a runtime error.

    Is somebody here who know how I can do that?

    Thanks for your efforts.
    Friday, October 28, 2005 9:36 AM

Answers