none
How to interact with the Outlook mail editor RRS feed

  • Question

  • Hi,

    I have just started working with Office 2010. In Office 2003 I had a set of producivity macros to eg. insert hyperlinks into emails just by pressing some keyboard shortcuts. They were actually word macros, I was using Word as my email editor. Although these macros work fine in Word 2010, I cannot seem to use that as an email editor any more so I want to re-create these macros in Outlook 2010.

    An example of what I want to do is:

    1. Get currently selected text (if any)

    2. Display this text in a input box, or empty box if no text selected

    3. Replace currently selected text with a URL based on inputted text (or if no text was selected then insert at the current insertion point)

    I am grappling with almost every aspect of this. For example, how to get a reference to the currently selected text / insertion point? How to insert a URL?

    Thanks in advance,

    Regards // Mike


    • Edited by eharmic Wednesday, September 26, 2012 3:27 AM
    Tuesday, September 25, 2012 12:38 AM

Answers

  • Answering my own question .....

    Apparently in Outlook 2010 it is using Word as an editor although the macros I defined in normal.dot were not being honoured.

    Anyway, inside an Outlook macro, you can do:

        Dim i As Inspector
        Dim s as Selection   
    
        Set i = ActiveInspector()
    
        If Not i.IsWordMail() Then
            MsgBox "Not a WordMail editor!"
            Exit Sub
        End If
    
        set s = i.WordEditor.Windows(1).Selection
    

    then you will be able to manipulate the selection in the same way as in Word.


    • Marked as answer by eharmic Wednesday, September 26, 2012 3:27 AM
    Wednesday, September 26, 2012 3:27 AM

All replies

  • Hi,

    Are you using Office for Mac?
    In this case I'm afraid that you'll find here little help (as it's more Outlook on Windows forum).

    It seems that OL2011 does not fully support VBA macros.
    Maybe you can try the recording macros, as (hopefully) explained here: http://mac2.microsoft.com/help/office/14/en-us/word/item/a94ea58a-3a46-4d14-bb32-7459783af9ef

    Hope it helps,
    Moshe

    Tuesday, September 25, 2012 7:20 AM
  • Hi Moshe,

    No I am using Windows. I just realized I put Office 2011 instead of 2010! I am of course using Outlook 2010.

    Also the Macro recorder is only available for Word & Excel, not for Outlook. But thanks for the reply!

    Regards // Mike


    • Edited by eharmic Wednesday, September 26, 2012 1:37 AM
    Wednesday, September 26, 2012 1:32 AM
  • Answering my own question .....

    Apparently in Outlook 2010 it is using Word as an editor although the macros I defined in normal.dot were not being honoured.

    Anyway, inside an Outlook macro, you can do:

        Dim i As Inspector
        Dim s as Selection   
    
        Set i = ActiveInspector()
    
        If Not i.IsWordMail() Then
            MsgBox "Not a WordMail editor!"
            Exit Sub
        End If
    
        set s = i.WordEditor.Windows(1).Selection
    

    then you will be able to manipulate the selection in the same way as in Word.


    • Marked as answer by eharmic Wednesday, September 26, 2012 3:27 AM
    Wednesday, September 26, 2012 3:27 AM