Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    856
    Thanks
    0
    Thanked 9 Times in 8 Posts

    Clearing Outlook selection

    I'm using Outlook 2010 and running VBA code which operates on the selected items in the Contacts folder.

    Code:
    For Each c In Outlook.ActiveExplorer.Selection
    ' do stuff
    Next
    When I have finished, I'd like to clear the selection, but I'm unable to find a way to do that. I found a post from Microsoft saying that it's not permitted because it's not safe/considerate for the user. Then I found something about a RemoveFromSelection method, but I don't see how to use that.

    Is it possible to clear the selected items in the Contacts (Active) Explorer once I'm finished?

    Thanks.

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    5,873
    Thanks
    0
    Thanked 79 Times in 75 Posts
    Based on the Help files, I would guess:
    Code:
    For Each c In Outlook.ActiveExplorer.Selection
    ' do stuff
    Outlook.ActiveExplorer.RemoveFromSelection c
    Next
    I haven't tested so I don't know if it works or if it would require you to loop backwards through the selection rather than using For Each.
    Regards,
    Rory
    Microsoft MVP - Excel.

  4. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    856
    Thanks
    0
    Thanked 9 Times in 8 Posts
    Thank you very much. This works perfectly. I used your line of code as you have it, before Next. No need to loop backward or use a separate For construct.
    Thanks again.
    Richard

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •