M
Michael
I am trying to get Outlook to search through our email for a subject
based on what is in certain cells in an outlook spreadsheet. Here is
the code I am using:
Sub SearchEmail()
dim "OrderNumber" As string
Dim objSch As Outlook.Search
Dim rsts As Outlook.Results
Dim i As Integer
blnSearchComp = False
Const strF1 As String = "urn:schemas:mailheader:subject =
'OrderNumber'"
Const strS1 As String = "Inbox"
Set objSch = _
Application.AdvancedSearch(Scope:=strS1, Filter:=strF1,
SearchSubFolders:=True, Tag:="SubjectSearch")
While blnSearchComp = False
DoEvents
Wend
Set rsts = objSch.Results
For i = 1 To rsts.Count
MsgBox rsts.Item(i).SenderName
Next
End Sub
The error that I am getting says, "Object doesn't support this property
or method."
And the line
Set objSch = _
Application.AdvancedSearch(Scope:=strS1, Filter:=strF1,
SearchSubFolders:=True, Tag:="SubjectSearch")
Is highlighted.
ANY HELP AT ALL IS GREATLY APPRECIATED. THANK YOU.
based on what is in certain cells in an outlook spreadsheet. Here is
the code I am using:
Sub SearchEmail()
dim "OrderNumber" As string
Dim objSch As Outlook.Search
Dim rsts As Outlook.Results
Dim i As Integer
blnSearchComp = False
Const strF1 As String = "urn:schemas:mailheader:subject =
'OrderNumber'"
Const strS1 As String = "Inbox"
Set objSch = _
Application.AdvancedSearch(Scope:=strS1, Filter:=strF1,
SearchSubFolders:=True, Tag:="SubjectSearch")
While blnSearchComp = False
DoEvents
Wend
Set rsts = objSch.Results
For i = 1 To rsts.Count
MsgBox rsts.Item(i).SenderName
Next
End Sub
The error that I am getting says, "Object doesn't support this property
or method."
And the line
Set objSch = _
Application.AdvancedSearch(Scope:=strS1, Filter:=strF1,
SearchSubFolders:=True, Tag:="SubjectSearch")
Is highlighted.
ANY HELP AT ALL IS GREATLY APPRECIATED. THANK YOU.