Results 1 to 6 of 6

Thread: sendkeys from Excel to Outlook

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2017
    Posts
    5

    sendkeys from Excel to Outlook

    Currently tasked with monitoring a group mailbox for specific subjects. While I can loop through the folder in VBA and look at each mailitem there are over 35,000 mail items and it takes hours to process. I note however, that I can manually enter CTRL-A, CTRL-C and paste the list into an Excel sheet in under two minutes.

    I have tried creating the Outlook mail app and setting a folder in VBA but can't get a handle on how to use sendkeys "{^A}" from the Excel app to the Outlook object.

    Any ideas greatly appreciated.

    Regards,
    vb1der

  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: sendkeys from Excel to Outlook

    What do you when you find the "specific subjects?" While there are 35,000 mail items, are there a lot that contain the subjects you're looking for? If not, maybe you could create an Outlook rule to copy them to a different folder?

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: sendkeys from Excel to Outlook

    depending on os version and other factors sendkeys may not work at all, but there are alternatives

    as i have no idea what your actual goal is, hard to make other suggestions, but there is a restrict method for mailitem collections

    what code have you tried so far
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2017
    Posts
    5

    Post Re: sendkeys from Excel to Outlook

    Quote Originally Posted by vbfbryce View Post
    What do you when you find the "specific subjects?" While there are 35,000 mail items, are there a lot that contain the subjects you're looking for? If not, maybe you could create an Outlook rule to copy them to a different folder?
    I am a member in the group folder but have not found a way to apply a rule to it. Once I find subjects that match a list I have in Excel I would prepare a report. The ultimate goal is to check that specific reports have gone out daily or monthly and prepare a mail to the boss to let him know if any of the reports are late going out.

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2017
    Posts
    5

    Re: sendkeys from Excel to Outlook

    i dim'ed a namespace for midi and an outlook application object and created a folder object from that hoping that i could use sendkeys as an event on the outlook object but no soap. The idea was to use Excel VBA and sendkeys to imitate the manual process of copy/paste the folder contents into an Excel sheet. The manual process only takes 3 to 5 minutes, while creating a folder object and looking at each item in the folder takes hours and hours on our network and sometimes pauses for minutes while Exchange catches up with the requests from outlook.
    Last edited by vb1der; May 5th, 2017 at 02:47 PM.

  6. #6
    Frenzied Member
    Join Date
    Oct 2012
    Location
    Tampa, FL
    Posts
    1,187

    Re: sendkeys from Excel to Outlook

    Did you try looking at alternative methods such as the Find method rather than blatantly looking at all items in the given folder?

    https://msdn.microsoft.com/en-us/lib...tems.find.aspx

    I know that looping the folders can take a LONG time because you have to unbox the mailitem to see its properties.

Posting Permissions

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



Click Here to Expand Forum to Full Width