none
Create a shortcut keystroke RRS feed

  • Question

  • I would like to create a VBA macro that inserts a Section symbol into at email at the point of the cursor.

    I have found it is not as simple in Outlook as it is in Word because of the email "body".

    Please advise.  Also once the macro is create, is there a way to create a shortcut keystroke to that macro?

    Monday, January 28, 2013 5:27 PM

Answers

All replies

  • Use Inspector.WordEditor to get the Document Word object. You can then use the same Word code to insert that symbol.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Monday, January 28, 2013 5:29 PM
  • Sorry for my naivety with Outlook coding, but I not sure how or where to include the Inspector.WordEditor code.  I tried in Sub routine:

        Dim olItem As Outlook.mailItem
        Dim olInspector As Outlook.Inspector
        Dim wdProp 
        Set olInspector = olItem.GetInspector
        Set wdProp = olInspector.WordEditor
        Selection.TypeText Text:="§ "

    I did not know what to initialize wdProp as.  I can't find much on Inspector.WordEditor in my searching.

    Monday, January 28, 2013 7:22 PM
  • Inspector.WordEditor returns Document interface from Word API, with this variable you can continue with word based code samples. http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.document.aspx
    • Marked as answer by Quist ZhangModerator Tuesday, February 5, 2013 11:54 AM
    • Unmarked as answer by orlandp Tuesday, February 19, 2013 8:44 PM
    • Marked as answer by orlandp Tuesday, February 19, 2013 8:45 PM
    • Unmarked as answer by orlandp Tuesday, February 19, 2013 8:48 PM
    Monday, January 28, 2013 7:35 PM
  • I saw to add a Reference to the Microsoft Word Object Library and was able to add a symbol to an existing email. 

    1)  How do I now connect this macro to a keystroke in Outlook?


    • Edited by orlandp Tuesday, February 19, 2013 9:59 PM
    Tuesday, February 19, 2013 9:55 PM
  • You can't. Outlook does not raise any events when a user presses a key.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Sunday, February 24, 2013 9:25 PM