+ Reply to Thread
Results 1 to 2 of 2

Copy the body of an incoming email to a tab in an Excel workbook then run an Excel macro

  1. #1
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Colorado Springs
    MS-Off Ver
    2016
    Posts
    481

    Copy the body of an incoming email to a tab in an Excel workbook then run an Excel macro

    I've got a big headache...

    I am fairly good at working with VBA with Excel; I'd probably be very good if my memory served me better (Thank Goodness for the folks on the Excel side of this board for all their help!!!), but I am lost in trying to work this out in Outlook VBA.

    When an eMail comes in
    with a Subject of "Supplies"
    I want to
    Verify Excel Workbook "Inventory.xlsm" is open, if not, open it.
    Copy the body of the email to a tab named "Supplies Import"
    Starting at cell "B4"
    Then have Excel run a sub/macro named "UpDate"

    It should be so easy! That is part of my headache - I searched and tried working with some examples for the "copy" part - I couldn't even get that to work. Then I also tried finding how it was that I once caused code to run when an incoming email matched my specifications, something like "Run a script" and I couldn't even find that. About the only thing I was successful at was turning on macros... pathetic...

    Anyway, I really appreciate your consideration and help!

  2. #2
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Colorado Springs
    MS-Off Ver
    2016
    Posts
    481

    Re: Copy the body of an incoming email to a tab in an Excel workbook then run an Excel ma


    No problem Bruce, I am glad to help. After half a day of research and testing, your first problem is that for some strangely unfathomable reason we have to counter the fact that Microsoft decided to hide the optional rule on incoming email that would allow us to be able to select "Run a Script". It is stated that this was to improve security, but as you would not only have to select this rule but previously further enter code into VBA module and then additionally select the script to run on your installation, hiding the rule does not make any more sense than hiding the ability to run any program on a computer. Maybe there is a good reason, but I don't know of it. Anyway, the solution for this can be found here.

    Next, after cobbling together items from several websites of good folks that posted code, try the following:


    Please Login or Register  to view this content.
    NOTE: I had to use the term (FilePath) instead of using the normal convention of a "lesser than" sign followed by the word FilePath and then a "greater than" sign; otherwise, the board's firewall, Securi, thought there was embedded HTML code and kept rejecting the post. And at first I thought it was because of my bad sense of humor... Anyway, where you see (FilePath), I have the proper path to the file included.

    Then you will probably want to "selfcert" the Outlook VBA module for otherwise you will be plagued with warnings - for that, please refer to this article.

    Now, honestly, as I don't know the exact nature of a good portion of the above code, I have little idea as to how to augment or improve, if possible, but I can say that it works.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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