My attempts to sort by EntryID creates:
Run-time error '-2147467259 (80004005)'
The operation failed.
I've looked at the MSDN Items.Sort Method page many times. EntryID is not on the list of Cannot Be Used specifically, so it must fall under "Category" or "Class"???
With 4000+ contacts it takes some time to copy them all from Outlook to Excel. So I was trying to sync only Outlook changes to Excel. To me sorting both data sets by EntryID would be the best way to go via For Next loops to sync adds, mods & deletes from Outlook to Excel. I was trying this in hopes that the testing and the skipping of matches would be faster than pulling a full copy of everything from Outlook. I can certainly do a full copy to a temporary table, sort and compare, but that means I've just done a full download PLUS the time to sync the two tables. This would take more time, not less.
Maybe EntryID is not the key field normally used in this type of operation? I'm new to Outlook and assumed such a field would be the best to key on, but apparently not. I was worried about using CompanyAndFullName as those are user changeable fields, but that field appears to be the only option for syncing. Or am I missing one that would be better?
Regarding the error created by the user closing Outlook (FYI opening Outlook while the VBA code is running is not an issue). The database links created by the VBA code simply disappear when the user closes Outlook while the VBA code is running. Effectively "Set objOutlook = Nothing" randomly in the middle of Excel's VBA code. This surprises me as I thought that the "Set objOutlook = New Outlook.Application" was creating a new and separate instance of Outlook that would be unaffected by the user's actions. This is not the case in my testing. Maybe I am not setting up my link to Outlook correctly??? Regardless, "Resume Next" fails because the connection to Outlook has been lost, completely. Maybe I'm wasting my time, but I'm working on reconnecting an picking up where the "interruption" happened now because I prefer to "bullet proof" my code.
Outlook's "features" are very frustrating and I'm in hopes that I'm missing something magical that will save me all this trouble... So if you have any ideas, please, please share.
Thank you.