+ Reply to Thread
Results 1 to 3 of 3

Selection changes while running code

  1. #1
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Selection changes while running code

    Hi guys,

    Purpose of code:
    selection multiple items(emails,meetings,etc) within an outlook mailbox and make a copy of those items on my computer(with some minor text edits to the body of the emails), each item is named with the date they were sent/received and their attachment's are separate out into a different folder.
    (This means I have all the emails in the correct order, with no emails with the same subject deleting each other. this also means I can remove attachments from emails, so the filesize is small)
    (Code seems to work on meetingitems, AppointmentItem, and mailitems, i havent tested for other mail item types)

    However I believe I have found a problem:
    I use "i02 = i02 + 1" and "ActiveExplorer.Selection.Item(i02)" and also ".copy". I believe that this combination of actions is the problem and I don't know how to fix it.

    I use ".copy" to create an "original" of each item, and also edit each mail item because I want a desktop version of each email item that says what attachments it once held were.
    I think the problems is occuring because my "selection" changes because whenever a "copy" is created, and becomes problematic when I run this code over multiple files.

    Any ideas how I can fix this?


    The second problem I have is, when I use this code one files one at a one, the selection jumps around from file to file, and makes it hard to determine if I can uses this code on every file or not.
    Any ideas how i can also fix this second problem?

    My Code:
    Please Login or Register  to view this content.
    Last edited by JimmyWilliams; 05-14-2021 at 03:37 AM.
    Thanks,

    JimmyWilliams

  2. #2
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Re: Selection changes while running code

    I'm still stuck on this problem, any help would be great.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,675

    Re: Selection changes while running code

    Moved from Excel Programming / VBA / Macros.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help with Center Across Selection Getting Reset Running at END IF Portion of VBA Code
    By ExcelMeister10520 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2019, 11:24 PM
  2. code works running in visual basic editor but not when running from Excel macro
    By smporco in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-06-2016, 05:44 PM
  3. [SOLVED] How to prevent worksheet code from running while Module Macro is running:
    By Chad Bateman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2015, 09:26 AM
  4. [SOLVED] Excel VB code. Message pops up while code running asking question. Code must not wait.
    By Heinrich Venter in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-28-2014, 06:10 AM
  5. Selection change macro keeps running
    By Subject_Name_Here in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-02-2012, 05:17 PM
  6. List Box Selection / Highligh Selection Code
    By Dr.SUN in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2010, 11:48 PM
  7. [SOLVED] Running code on a drop down selection change
    By Steve Haack in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-26-2005, 12:06 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1