I want to place the entered keyword from excel in to search bar in outlook. I referred to this doc and tried this.

    Dim OutApp As Object, wK As Worksheet, kWd As String
    Set wK = Sheet1

    kWd = Trim(wK.Range("D4").Value)

    kWd = "urn:schemas:mailheader:subject = " & kWd

    Set OutApp = CreateObject("Outlook.Application")
    'Searches the Inbox folder

    Dim objSch As Outlook.Search
    Const strS As String = "Inbox"
    Const strTag As String = "SubjectSearch"
    Set objSch = _
       OutApp.AdvancedSearch(Scope:=strS, Filter:=kWd, Tag:=strTag)
I am getting Run-time error 446: object doesn't support named arguments error on the last line.

I am not sure if this is the correct way to do this.


search.jpg