Not sure but if the debug.print is outputting to the Outlook immediate window I would have thought the code in outlook was executing rather than that which is in Excel.
Is that outlook code still in outlook?
Standard code module
Public g_clsTest As Class1
Sub TestAdvancedSearchComplete()
Dim strF As String
Const strS As String = "'\\Business Contact Manager\Business Contacts'"
Set g_clsTest = New Class1
g_clsTest.AdvSearch strS, strF
End Sub
Class code Class1
Public WithEvents olApp As Outlook.Application
Private m_sch As Outlook.Search
Public Sub AdvSearch(MyScope As String, MyFilter As String)
Set m_sch = olApp.AdvancedSearch(MyScope, MyFilter)
End Sub
Private Sub Class_Initialize()
Set Me.olApp = CreateObject("Outlook.application")
End Sub
Private Sub Class_Terminate()
Set Me.olApp = Nothing
End Sub
Private Sub olApp_AdvancedSearchComplete(ByVal SearchObject As Outlook.Search)
Dim rsts As Outlook.Results
Dim i
Set rsts = m_sch.Results
For i = 1 To rsts.Count
Debug.Print rsts.Item(i).CompanyName; _
" - "; rsts.Item(i).FullName; vbCr;
Next
End Sub
The above uses a class object to trigger and capture the advance search.