![]() |
|
Running a macro
How do I get a macro to run automatically every time an email is
opened |
Running a macro
Put code in the Inspectors.NewInspector event handler. This code needs to go into the built-in ThisOutlookSession module:
Dim WithEvents colInsp As Outlook.Inspectors Private Sub Application_Startup() Set colInsp = Application.Inspectors End Sub Private Sub colInsp_NewInspector(ByVal Inspector As Inspector) Call yourMacro ' call your macro here End Sub -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "SuperSlueth" wrote in message ... How do I get a macro to run automatically every time an email is opened |
Running a macro
Thanks I tried it but I need to let the email open completly before it
runs the macro. I'm trying to open all attachments automatically when the email is opened. Your solution acts too early. How can i set it so it only runs the macro automatically after the email is opened |
Running a macro
If it's a timing issue, you may have to experiments with different approaches, such as a loop that waits for a few seconds or using the Inspector.Activate event or using NewInspector to instantiate a MailItem object WithEvents and putting your code in that object's Open event.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "SuperSlueth" wrote in message ... Thanks I tried it but I need to let the email open completly before it runs the macro. I'm trying to open all attachments automatically when the email is opened. Your solution acts too early. How can i set it so it only runs the macro automatically after the email is opened |
Running a macro
I tried this, but found that the code needs to complete then the
email opens. This gives me errors as i can't do anything with the attachments at this stage. What i Need is something that will run after the form has completed opening |
Running a macro
Tried what. It's impossible to know what message you're responding to. Please quote earlier messages.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "SuperSlueth" wrote in message ... I tried this, but found that the code needs to complete then the email opens. This gives me errors as i can't do anything with the attachments at this stage. What i Need is something that will run after the form has completed opening |
Running a macro
On Fri, 3 Feb 2006 08:39:16 -0500, "Sue Mosher [MVP-Outlook]"
wrote: Tried what. It's impossible to know what message you're responding to. Please quote earlier messages. If it's a timing issue, you may have to experiments with different approaches, such as a loop that waits for a few seconds or using the Inspector.Activate event or using NewInspector to instantiate a MailItem object WithEvents and putting your code in that object's Open event. I tried this, buit these need to finish before the mail opens completely I made a call to a macro that has 1 line in it ....msgbox "test" Untill i click the ok button the mail dosent' open ... Itried counting the number of attachments but it gives an error, becaus the mail is not fullu opened. What i need is something that start when the email is fully opened |
Running a macro
I guess it might help if you described exactly what you have in mind by "the email is fully opened" and why you need to wait until then.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "SuperSlueth" wrote in message ... On Fri, 3 Feb 2006 08:39:16 -0500, "Sue Mosher [MVP-Outlook]" wrote: Tried what. It's impossible to know what message you're responding to. Please quote earlier messages. If it's a timing issue, you may have to experiment with different approaches, such as a loop that waits for a few seconds or using the Inspector.Activate event or using NewInspector to instantiate a MailItem object WithEvents and putting your code in that object's Open event. I tried this, buit these need to finish before the mail opens completely I made a call to a macro that has 1 line in it ....msgbox "test" Untill i click the ok button the mail dosent' open ... Itried counting the number of attachments but it gives an error, becaus the mail is not fullu opened. What i need is something that start when the email is fully opened |
Running a macro
On Fri, 3 Feb 2006 12:03:49 -0500, "Sue Mosher [MVP-Outlook]"
wrote: I guess it might help if you described exactly what you have in mind by "the email is fully opened" and why you need to wait until then. i'm trying to get macro to open multiple attachements automatically when an email is opened. I used your sugestions to run the macro. in the macro is the lines (just as a test to see if it works at the right time. dim I as interger I=Application.ActiveInspector.CurrentItem.Attachme nts.Count MsgBox I If i try to run it as you suggest when I double click the email .. it runs the macro and gives and error because the email window is not opened. If i let the email open without running your suggestion and then run the macro from the Tools/macro menu option ... it works fines and returns the correct count for the number of attachments I hope this makes it more clear what i\'m trying to acheive Thanks for your efforts ... I\'m new to programming and had this one dropped on me |
Running a macro
What errror? What\'s the mail environment? Do you see any different behavior with different format messages?
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "SuperSlueth" wrote in message ... On Fri, 3 Feb 2006 12:03:49 -0500, "Sue Mosher [MVP-Outlook]" wrote: I guess it might help if you described exactly what you have in mind by "the email is fully opened" and why you need to wait until then. i\'m trying to get macro to open multiple attachements automatically when an email is opened. I used your sugestions to run the macro. in the macro is the lines (just as a test to see if it works at the right time. dim I as interger I=Application.ActiveInspector.CurrentItem.Attachme nts.Count MsgBox I If i try to run it as you suggest when I double click the email .. it runs the macro and gives and error because the email window is not opened. If i let the email open without running your suggestion and then run the macro from the Tools/macro menu option ... it works fines and returns the correct count for the number of attachments I hope this makes it more clear what i\'m trying to acheive Thanks for your efforts ... I\'m new to programming and had this one dropped on me |
All times are GMT +1. The time now is 07:10 AM. |
|
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com