![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I had a macro in Outlook XP that entered a certain amount of text and
formatted it. We use it in most of our emails and immediately run it when creating a new email. It worked fine. (For what it is worth, I copied it into a Word 2007 macro and it worked fine there also). I cannot figure out to create this macro in Outlook 2007. I went to trust center and enabled all macros with no security at all. I went to Tools, Macros, Visual Basic Editor. In the top left box I created a new module and pasted in the text of the macro. But now I cannot figure out how to run it in a new email. In a newly created macro there is no tool option to call up a macro. I try to run it within the visual basic editor, but I get an error message that says macros in this project are disabled and refers me to online help for how to enable macros. How do I create a macro that I can run upon opening a new email that is to be sent? If it matters at all, the text in the macro is: Sub EmailProtocol() ' ' EmailProtocol Macro ' Macro recorded 8/22/2006 by Gisele Prive ' Selection.InsertDateTime DateTimeFormat:="d-MMM-yy", InsertAsField:=False, _ DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _ InsertAsFullWidth:=False Selection.TypeText Text:=" " Selection.InsertDateTime DateTimeFormat:="HH:mm", InsertAsField:=False, _ DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _ InsertAsFullWidth:=False Selection.TypeText Text:=" PST " Selection.MoveLeft Unit:=wdCharacter, Count:=2 Selection.MoveLeft Unit:=wdCharacter, Count:=9, Extend:=wdExtend Selection.Font.Bold = wdToggle Selection.EndKey Unit:=wdLine Selection.TypeText Text:="-- Folder" Selection.TypeParagraph Selection.TypeParagraph Selection.TypeText Text:="Message Subject " Selection.MoveUp Unit:=wdLine, Count:=2 Selection.MoveRight Unit:=wdWord, Count:=2 End Sub |
Ads |
#2
|
|||
|
|||
![]()
You can add a macro call command to the QAT in an Outlook email. Each type
of Outlook item has its own ribbon and QAT, so if you want the macro call in the QAT for both reading emails and composing them you'd need to add it to both QAT's. Right-click on the ribbon and select Customize Quick Access Toolbar. Select Macros in the choose commands from drop-down. Select your macro. You can also put code in the ThisOutlookSession class module that's instantiated in Application_Startup() that instantiates an Inspectors collection declared WithEvents that's used to handle the NewInspector() event. In that event you instantiate an Inspector object declared WithEvents to the new Inspector. Then in the first Inspector.Activate() event you can call to your macro code. Note that your code will work only if the full Word 2007 is also installed. Also, there is a behavior change in Outlook 2007 where the item in the Inspector in NewInspector() is not fully populated with properties until the first Inspector.Activate() event. Until then it's a weak object reference. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "rmccafferty" wrote in message ... I had a macro in Outlook XP that entered a certain amount of text and formatted it. We use it in most of our emails and immediately run it when creating a new email. It worked fine. (For what it is worth, I copied it into a Word 2007 macro and it worked fine there also). I cannot figure out to create this macro in Outlook 2007. I went to trust center and enabled all macros with no security at all. I went to Tools, Macros, Visual Basic Editor. In the top left box I created a new module and pasted in the text of the macro. But now I cannot figure out how to run it in a new email. In a newly created macro there is no tool option to call up a macro. I try to run it within the visual basic editor, but I get an error message that says macros in this project are disabled and refers me to online help for how to enable macros. How do I create a macro that I can run upon opening a new email that is to be sent? If it matters at all, the text in the macro is: Sub EmailProtocol() ' ' EmailProtocol Macro ' Macro recorded 8/22/2006 by Gisele Prive ' Selection.InsertDateTime DateTimeFormat:="d-MMM-yy", InsertAsField:=False, _ DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _ InsertAsFullWidth:=False Selection.TypeText Text:=" " Selection.InsertDateTime DateTimeFormat:="HH:mm", InsertAsField:=False, _ DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _ InsertAsFullWidth:=False Selection.TypeText Text:=" PST " Selection.MoveLeft Unit:=wdCharacter, Count:=2 Selection.MoveLeft Unit:=wdCharacter, Count:=9, Extend:=wdExtend Selection.Font.Bold = wdToggle Selection.EndKey Unit:=wdLine Selection.TypeText Text:="-- Folder" Selection.TypeParagraph Selection.TypeParagraph Selection.TypeText Text:="Message Subject " Selection.MoveUp Unit:=wdLine, Count:=2 Selection.MoveRight Unit:=wdWord, Count:=2 End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
creating rules in macro or other way? | Pwint | Outlook - General Queries | 2 | November 7th 07 01:59 AM |
creating a macro using FIND | Ale | Outlook and VBA | 1 | April 19th 07 11:12 PM |
Creating a macro for archiving | karamatic | Outlook and VBA | 1 | October 10th 06 07:46 AM |
Creating a macro... I think | Casey | Outlook - General Queries | 9 | July 27th 06 06:29 PM |
Creating a new Macro in Outlook | jpotucek | Outlook and VBA | 3 | April 27th 06 03:30 PM |