+ Reply to Thread
Results 1 to 8 of 8

Using Outlook to run a script

  1. #1
    Registered User
    Join Date
    05-11-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Angry Using Outlook to run a script

    Hi guys,

    I wrote a VBA on outlook which basically saves an attachment into a folder and then runs a vba code in another excel file that is saved in that folder also. However, it only runs the first vba in the second excel file. For simplicity, i have two codes in the second excel file, first is output Test in cell and then second code is create a new excel workbook and save it in the folder also.

    here is the outlook code:
    Please Login or Register  to view this content.


    Here is the code for second excel file
    Please Login or Register  to view this content.
    Why doesnt my outlook code run both these macros?
    Last edited by wolfdemon710; 05-25-2015 at 12:49 PM. Reason: Added code tags

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Using Outlook to run a script

    Double posted.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Using Outlook to run a script

    You'll need to put your code in [Code] tags to meet forum standards.

    In the meantime though, why are you calling AddNewWorkbook2 twice? You're calling it in the Outlook code but also at the end of the TestOpen sub
    If someone has helped you then please add to their Reputation

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Using Outlook to run a script

    It's also double posted, see my post above yours.

    Quote Originally Posted by pjwhitfield View Post
    You'll need to put your code in [Code] tags to meet forum standards.

    In the meantime though, why are you calling AddNewWorkbook2 twice? You're calling it in the Outlook code but also at the end of the TestOpen sub

  5. #5
    Registered User
    Join Date
    05-11-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Re: Using Outlook to run a script

    Hi,

    I have added the code tags and i edited the other posts and said solved. Sorry new to the forum.

    Sorry i have edited the code, it should be calling from the outlook file, not the TestOpen sub.

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Using Outlook to run a script

    I have added the code tags and i edited the other posts and said solved. Sorry new to the forum.
    Thanks.

    I don't see anything obvious. Have you tried putting the word stop in your code so it will stop it and then stepping through it line by line to see what's happening.

    I'm also curious are you calling this:
    Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
    from some other code not shown? I ask because you have a parameter in between the () but I don't see you calling this procedure in the code you posted. I'll admit I have no experience with Outlook code but in the Sub Application_StartUp() I would put a Stop in there to see what happens on the lines where you are using Application.Run and then step through the code.

  7. #7
    Registered User
    Join Date
    05-11-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Re: Using Outlook to run a script

    Hey,

    Thanks for the reply. I tried and steped through the code, but it just go through the step without any errors but the vba isnt run. :S So confusing.

  8. #8
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Using Outlook to run a script

    If you want help then you need to be specific. Stepping through code without errors means the VBA did run.
    So where are you starting, what happens at each step, when you call a sub does it jump to that other sub, do all the lines in the other sub run?
    You also didn't answer the question I asked you in my last post.

+ 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. Need a 2nd Outlook rule to trigger a 2nd script.
    By Agent-311 in forum Outlook Programming / VBA / Macros
    Replies: 6
    Last Post: 03-10-2015, 03:39 PM
  2. Outlook VBA running a script with a rule.
    By Rchie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2015, 11:23 AM
  3. [SOLVED] Running Up Outlook And VBA Script From a Scheduled Task
    By TheWarehouseGroupLtd in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2014, 05:12 PM
  4. Wanted: VBA Script to use for Outlook signatures
    By JDLM66062 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2013, 05:35 PM
  5. Can I trigger a VBA script without pausing Outlook for the duration?
    By baldmosher in forum Outlook Programming / VBA / Macros
    Replies: 5
    Last Post: 08-05-2013, 07:19 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