How many subs can run in one outlook VBA script

Status
Not open for further replies.
Outlook version
Outlook 2007
Email Account
IMAP
I would like to run a script (that you already helped me with) to send Email information to Trello. I would also like to send a copy of that same information to an Excel Spread Sheet which I managed to do with some slight modifications of one of your sample scripts. My question is how do I run them both on the same message as it arrives? Do I put them inside the same script and if so do I end Sub and start the second Sub?Attached is a copy of both my Modules.
 

Attachments

  • sent2Excel.pdf
    362.1 KB · Views: 673
  • sent2Trello.pdf
    278.2 KB · Views: 267

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
There's no limit, and there's a lot of ways to accomplish it. This is one:
Code:
public sub CallThisByYourRule(mail as mailitem)
   script_one mail
  script_two mail
end sub

private sub script_one(mail as mailitem)
end sub

private sub script_two(mail as mailitem)
end sub
 
Outlook version
Outlook 2007
Email Account
IMAP
There's no limit, and there's a lot of ways to accomplish it. This is one:
Code:
public sub CallThisByYourRule(mail as mailitem)
   script_one mail
  script_two mail
end sub

private sub script_one(mail as mailitem)
end sub

private sub script_two(mail as mailitem)
end sub
Nice. Thanks. I'll give it a try... Were you able to answer the two minor issues I have with my private subs?
Excel works but I need to grab the CC# at the top and haven't been able to do it inside the current pattern...
And I'm not sure how you make these apply to all emails in a folder instead of just the one that is selected.
 
Outlook version
Outlook 2007
Email Account
IMAP
At the beginning of this thread I included two scripts that I'm running. inside the documents are an issues at the top.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Assuming both scripts work individually, use the example Michael posted with 3macros. One macro is called by a rule an it calls macro1. When macro1 is finished, it goes back to the original macro and runs macro2.

You could put both together in one macro, but using two can be less confusing and allows you to run them separately, if needed.

If you need to share variables, you can do that too.

public sub CallThisByYourRule(mail as mailitem)
' run this macro first
script_one mail
' when the macro above is finished, return and run the second macro.
script_two mail
end sub
private sub script_one(mail as mailitem)
end sub
private sub script_two(mail as mailitem)
end sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Moved many emails to Outlook external folder, need to delete on Gmail server Using Outlook 14
B Task Filter Not Working When I add too many criteria Using Outlook 0
T Many problems with outlook.com - will upgrade to Outlook soon Using Outlook 1
D Too many scripts? Outlook VBA and Custom Forms 1
GregS Outlook 2016 Too Many Archives Using Outlook 0
GregS Many Sent Item folders Using Outlook 3
P how to remove unwanted PST file default categories assigned to many calendar entries Using Outlook 7
L Why do i get so many drafts? Using Outlook 12
T Received many email without information Using Outlook 1
M How many days are items in Recover Deleted at Outlook.com ? Using Outlook.com accounts in Outlook 4
O Copy mails from many subfolders to 1 foldr Using Outlook 2
C too many choices for time zones! can i reduce to actual time zones only? Using Outlook 1
M warning for too many appointments on a same day in Outlook Using Outlook 1
M Charter ISP Claims Outlook Generating STMP Errors of Too Many Recipients Using Outlook 1
D Meeting Request - Too Many Recipients Using Outlook 0
Diane Poremsky "Too many files" Error Message New Slipstick.com Articles 0
O W-a-a-y too many PSTs (Outlook 2003) Using Outlook 0
I Many empty Contacts folders.. cannot get rid of them Using Outlook 4
A Importing too many emails from Gmail Using Outlook 2
R Many folders Using Outlook 11
R Rules - many or few Using Outlook 10
mikecox Too many "contacts" lists Using Outlook 2
S Setup many personal calendars on outlook 2013 on new laptop- starting over Using Outlook 1
W Outlook 2010 has many inbox folders Using Outlook 5
C Many Expiration Dates in Custom Form Using Outlook 1
T Public Folder has many messages but can't be seen in Outlook Using Outlook 3
R How many seconds usually takes an email to get to an outlook account? Using Outlook 0
J Want ONE inbox MANY accounts Using Outlook 2
R Too Many Devices Using Outlook 2
C BCC - How many email address will it accomodate? Using Outlook 2
R Too many folders in Outlook 2013 Using Outlook 11
D Navigate to my calendar. Too many steps Exchange Server Administration 2
B Problem with fix for "Too Many Contact Folders" Using Outlook 3
B [outlook-users] Re: Why have I gotten to many "reminders" for birthdays that "occurred" on Jan. 1??? Using Outlook 3
M Outlook 2010 is loading many times already received emails from external acc. Using Outlook 4
C Updating many contacts at once? BCM (Business Contact Manager) 3
D How Many Exchange Accounts in Outlook? Exchange Server Administration 3
B Too many ' tasks' when checking email Using Outlook 1
D Outlook 2010 error - you are attempting to attach too many files at once Using Outlook 11
R When I try to send an email to many people, I receive the following error message: (0x8004010F): The Using Outlook 1
C 452 4.1 1. requested action aborted:try again later, too many recipients Using Outlook 4
R Too many inboxes Outlook 2010 Using Outlook 2
J Too many email folders on MSN issue. Migrate to Outlook? Using Outlook 3
M Problem with Outlook 2007 - hotmail not coming in, difficulties sending out, many many other problems Using Outlook 4
J Re: Outlook 2010: The task list is empty in the to do bar but there are many tasks there. Using Outlook 4
G Re: Outlook 2010: The task list is empty in the to do bar but there are many tasks there. Using Outlook 1
K How many old e-mails can Outlook 2010 store, access, and manage? Megabytes or Gigabytes? Using Outlook 2
S Views on frequently updated public folders in Outlook 2003 for many users Using Outlook 1
C Cannot start Outlook, prompted with “too many failed open attempts” error Can’t find my name in the Microsoft server, what do I do. Using Outlook 2
H Too Many Names error when configuring new account in Outlook Using Outlook 3

Similar threads

Top