![]() |
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
|
|||
|
|||
![]()
The site
http://turtleflock-ol2007.spaces.liv...E3D8!579.entry gives a nice clear description of how to create a macro in Outlook 2007. What I tried is: Sub Blue() Dim objDoc As Word.Document Dim objSelection As Word.Selection On Error Resume Next Set objDoc = Application.ActiveInspector.WordEditor Set objSelection = objDoc.Windows(1).Selection objSelection.Font.Color = wdColorBlue Set objSelection = Nothing Set objDoc = Nothing End Sub Unfortunately, this does not work. I am using Outlook 2007, and have the latest updates (12.0.6504.5000) SP2 MSO (12.0.6425.1000) ... am running WinXP, Service Pack 3. |
Ads |
#2
|
|||
|
|||
![]()
What specifically doesn't work? Do you have an item open with some text
selected? What happens if you comment out the On Error Resume Next statement and then step through the code in the debugger? Does any VBA code run at all? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "cte67" wrote in message ... The site http://turtleflock-ol2007.spaces.liv...E3D8!579.entry gives a nice clear description of how to create a macro in Outlook 2007. What I tried is: Sub Blue() Dim objDoc As Word.Document Dim objSelection As Word.Selection On Error Resume Next Set objDoc = Application.ActiveInspector.WordEditor Set objSelection = objDoc.Windows(1).Selection objSelection.Font.Color = wdColorBlue Set objSelection = Nothing Set objDoc = Nothing End Sub Unfortunately, this does not work. I am using Outlook 2007, and have the latest updates (12.0.6504.5000) SP2 MSO (12.0.6425.1000) ... am running WinXP, Service Pack 3. |
#3
|
|||
|
|||
![]()
I get the msg, "Compile error: User-defined type not defined", on the "Dim
objDoc As Word.Document" line. No change if I comment out the "On Error Resume Next" line. Am unable to step through the code in the debugger. "Sue Mosher [MVP]" wrote: What specifically doesn't work? Do you have an item open with some text selected? What happens if you comment out the On Error Resume Next statement and then step through the code in the debugger? Does any VBA code run at all? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 |
#4
|
|||
|
|||
![]()
Use the Tools | References dialog to add a reference to the Microsoft Word
library to your project. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "cte67" wrote in message ... I get the msg, "Compile error: User-defined type not defined", on the "Dim objDoc As Word.Document" line. No change if I comment out the "On Error Resume Next" line. Am unable to step through the code in the debugger. |
#5
|
|||
|
|||
![]()
I found it under VB. It works now! Thanks!
Under Macro Security, I set "Warnings for all Macros". After the macro is displayed, I do a "File - Save". However, after I close Outlook and restart, it always asks about enabling macros when I try to run the macro. I did run SelfCert.exe ... gave it the name Macros. No difference ... still asks about enabling macros after I restart Outlook. "Sue Mosher [MVP]" wrote: Use the Tools | References dialog to add a reference to the Microsoft Word library to your project. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 |
#6
|
|||
|
|||
![]()
"Warnings for All Macros" does exactly what it says -- warns you regardless
of whether the project has been digitally signed. Try using Tools | Digital Signature to sign the project, then set macro security to "Warn for signed macros." -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "cte67" wrote in message ... Under Macro Security, I set "Warnings for all Macros". After the macro is displayed, I do a "File - Save". However, after I close Outlook and restart, it always asks about enabling macros when I try to run the macro. I did run SelfCert.exe ... gave it the name Macros. No difference ... still asks about enabling macros after I restart Outlook. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
New User Wants to Create Macros in Outlook | NeedOutlookMacroHelp | Outlook and VBA | 1 | January 21st 09 03:32 PM |
Outlook 2007 and macros | Ratzaz | Outlook - Installation | 1 | September 17th 08 10:23 PM |
Macros - Word 2007 and Outlook 2007 | hunter | Outlook and VBA | 6 | November 9th 07 11:00 PM |
How to best imitate using Word macros in Outlook 2007 | AMolotkov | Outlook - General Queries | 3 | December 25th 06 04:58 PM |
Enabling VBA macros in Outlook 2007 | David Hyde | Outlook and VBA | 2 | September 30th 06 10:56 AM |