• Macro: Message Format Mod’s (Outlook (2000))

    Home » Forums » AskWoody support » Productivity software by function » MS Outlook and email programs » Macro: Message Format Mod’s (Outlook (2000))

    • This topic has 5 replies, 3 voices, and was last updated 19 years ago.
    Author
    Topic
    #431031

    Hello y’all,

    I have a client who is seeking to automate the following in a Macro in Outlook (2K) (We will be transitioning to Outlook 2003, so the macros must be able to run in 2003)

    1. From a message choose Format->Plain Text
    2. Say Yes to the warning.
    3. Again choose Format->Rich Text and the process is done.

    Also, would like to get a “HTML_to_RTF” macro and a “RTF_to_HTML” macro if possible.

    Is this possible?

    Thanks much,
    Rich

    Viewing 0 reply threads
    Author
    Replies
    • #1007953

      You can use the following as starting point. If an error occurs (for example because no mail item is open), the macros just beep. You can uncomment the MsgBox line to display an errror message instead.

      Sub Convert2RTF()
      On Error GoTo ErrHandler
      ActiveInspector.CurrentItem.BodyFormat = olFormatRichText
      Exit Sub
      ErrHandler:
      ‘ MsgBox Err.Description, vbExclamation
      Beep
      End Sub

      Sub Convert2HTML()
      On Error GoTo ErrHandler
      ActiveInspector.CurrentItem.BodyFormat = olFormatHTML
      Exit Sub
      ErrHandler:
      ‘ MsgBox Err.Description, vbExclamation
      Beep
      End Sub

      Sub Convert2Plain()
      On Error GoTo ErrHandler
      ActiveInspector.CurrentItem.BodyFormat = olFormatPlain
      Exit Sub
      ErrHandler:
      ‘ MsgBox Err.Description, vbExclamation
      Beep
      End Sub

      • #1007960

        To permanently convert the format, I expect you would need:

        ActiveInspector.CurrentItem.Save

        After each

        ActiveInspector.CurrentItem.BodyFormat = …

        line. Also, conversion of some HTML messages to text, especially those with tables, may result in a jumbled mess (voice of experience on this).

        • #1007964

          I thought about .Save, but left it out intentionally to give the user a chance to close the e-mail without saving if the result is not satisfactory – as you indicate it may be. But a good point.

      • #1008206

        Dear Hans,

        As usual, you’ve come to the rescue! Thanks so much.

        What I thought would be a simple task is confusing to me now.

        I thought the macros would be run when an email message is open, rather than in a folder list view. If so, where do I save the macro VBA?

        Thanks so much,
        Rich

        • #1008218

          As usual, macros are stored in a module in the Visual Basic Editor.
          – In Outlook, press Alt+F11 to activate the Visual Basic Editor.
          – Select Insert | Module to create a new module.
          – Type or copy the macros into the module.

          You can assign macros to a toolbar button or menu item:
          – Open an e-mail.
          – Select Tools | Customize…
          – Activate the Commands tab.
          – Select the Macros category.
          – Drag the macros to the toolbar of the e-mail window.

    Viewing 0 reply threads
    Reply To: Macro: Message Format Mod’s (Outlook (2000))

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: