A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Running a macro



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 1st 06, 03:54 PM posted to microsoft.public.outlook.program_forms
SuperSlueth
external usenet poster
 
Posts: 24
Default Running a macro

How do I get a macro to run automatically every time an email is
opened
Ads
  #2  
Old February 1st 06, 03:58 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default 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

  #3  
Old February 2nd 06, 11:42 AM posted to microsoft.public.outlook.program_forms
SuperSlueth
external usenet poster
 
Posts: 24
Default 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
  #4  
Old February 2nd 06, 03:26 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default 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

  #5  
Old February 3rd 06, 05:44 AM posted to microsoft.public.outlook.program_forms
SuperSlueth
external usenet poster
 
Posts: 24
Default 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
  #6  
Old February 3rd 06, 01:39 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default 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 news
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

  #7  
Old February 3rd 06, 04:45 PM posted to microsoft.public.outlook.program_forms
SuperSlueth
external usenet poster
 
Posts: 24
Default 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
  #8  
Old February 3rd 06, 05:03 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default 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

  #9  
Old February 3rd 06, 09:58 PM posted to microsoft.public.outlook.program_forms
SuperSlueth
external usenet poster
 
Posts: 24
Default 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
  #10  
Old February 3rd 06, 11:28 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default 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

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
My Outlook 2003 is running very slow, why? com Outlook - General Queries 6 May 15th 07 04:40 PM
Is outlook meant to be left running? [email protected] Outlook - General Queries 1 February 28th 06 03:20 AM
Create a re-running rule JDR Outlook - General Queries 2 February 15th 06 09:17 PM
Running rules on mailbox other than the default Brian Beck Outlook - General Queries 1 February 3rd 06 09:26 PM
an outlook2000 macro programming question..... Alont Outlook - General Queries 0 January 8th 06 03:14 AM


All times are GMT +1. The time now is 01:51 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.