How to remove duplicate signatures in Outlook 2010 Macro

23
2014-04
  • Tyler Nealis

    I have made a Macro for a client. They are complaining that when they execute the Macro that it comes up with two signatures. If I disable signatures neither show up. I was wondering if there is code that can remove duplicate signatures in my Macro. Please help!

    The code is:

    Sub Project2()
    Set msg = Application.CreateItemFromTemplate("C:\Documents and Settings\tnealis\Application Data\Microsoft\Templates\Macro Test2.oft")
    msg.Display
    End Sub
    
  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    How to execute Outlook 2010 macro with AutoHotKey?
  • Steve Crane

    Having found that I can't bind custom keyboard shortcuts to macros I've written for Outlook 2010, I turned to AutoHotKey and have a working solution, but it's clumsy. Here is one script and I have two more that execute different macros.

    #IfWinActive, Inbox
    ^!1::
    Send, {ALTDOWN}{F8}{ALTUP}
    WinWaitActive, ahk_class #32770, Macros, 0
    Send, ActionSelectedMessages{ALTDOWN}r{ALTUP}
    return
    

    It sends Alt-F8 to open the Macros dialog, waits for the window to open, then sends the name of the macro followed by Alt-R to run it. This works but is slow and ugly with the dialog opening and closing.

    So my question is whether there is any way to execute an Outlook macro from AutoHotKey that will not cause any interface side-effects as this solution does?


  • Related Answers
  • 8088

    It turns out that this is rather easy to do. I had already added my three macros to the home strip in the Outlook ribbon and discovered that you can't bind shortcut keys as you could when adding items to the old toolbar. But what I didn't notice, is that shortcuts are automatically assigned to the new ribbon items, as seen in the screenshot.

    alt text

    Knowing that, it's possible to invoke these functions with three keystrokes; Alt-H, followed by Y1, Y2 or Y3. Taking this a step further I modified my AutoHotKey script to send these keystrokes and have now reduced these to the single keystrokes Alt-1, Alt-2 and Alt-3. Here is the script.

    #IfWinActive, ahk_class rctrl_renwnd32
    !1::
    Send, {ALTDOWN}H{ALTUP}Y1
    return
    
    !2::
    Send, {ALTDOWN}H{ALTUP}Y2
    return
    
    !3::
    Send, {ALTDOWN}H{ALTUP}Y3
    return
    
  • Simon Sheehan

    I was able to accomplish something similar by adding it to the Quick Access Toolbar. Right click on whatever button you want a hotkey on, set it to Quick Access Toolbar, and it automatically gets an ALT + # combination.

  • Tom Wijsman

    Have you written a Visual Basic for Applications (VBA) macro that you'd like to run without going through the Macros dialog box? With the Customize dialog box open, under Categories, select Macros and drag your macro to a toolbar. Macro names tend to be long and ugly, so right-click the macro button and change the macro's name. Add an ampersand to set a hot key if you use the macro frequently.

    Source: http://www.windowsitpro.com/article/outlook-2000/adding-hot-keys-and-tool-bar-buttons.aspx

    Maybe you can accomplish this in the same way in Outlook 2010?

    If not, you will need to write an add-on instead of a macro... But that would be a StackOverflow question.