"Paste As Quotation" in Outlook 2007

A

AdamK

I can't seem to figure out how to "Paste as Quotation" in Outlook
2007. This is such a basic piece of functionality for an email
program, I'm sure its there somewhere and I just can't find it. Just
to clarify, "Paste as Quotation" means that when I paste a chunk of
text into an email message it appears as:
This is some text that I am
quoting and responding to.

If I were designing things, I would probably put "Paste as Quotation"
in the "Paste Special..." menu, but its not there.

Note: I'm aware of the "Email Options" setting for "On replies and
forwards" to "Prefix each line of the original message". This is
definitely useful, but does not handle the case where I'm pasting text
from another source.

Thanks in advance for your help.
 
B

Brian Tillman [MVP - Outlook]

I can't seem to figure out how to "Paste as Quotation" in Outlook
2007. This is such a basic piece of functionality for an email
program, I'm sure its there somewhere and I just can't find it. Just
to clarify, "Paste as Quotation" means that when I paste a chunk of
text into an email message it appears as:

If it's so basic, why do so may mail clients not have it?

Feel free to write your own code to accomplish it.
http://www.outlookcode.com/ is a good place to start.
 
A

AdamK

Brian said:
If it's so basic, why do so may mail clients not have it?

I guess we must use different mail clients. Thunderbird (Windows/Mac/
Linux), Mulberry (Windows/Mac/Linux), Eudora (Windows/Mac), Mail
(Mac), and even Microsoft Office Entourage 2008 (Mac) all have it.
Feel free to write your own code to accomplish it. http://www.outlookcode.com/ is a good place to start.

Fair enough. I've included the code for my VBA macro below. It is
targeted at Outlook 2007. Thanks to Mathias Chauvin for posting the
code I based this on (http://blog.mc-thias.org/?
title=macro_for_paste_as_quotation_ability_in__2003). I've tried to
make it reasonably smart about further quoting already quoted
material, and about word wrapping. For my own use, I have put this
macro in my Quick Access Toolbar. Two additional features I would add,
if I knew how:
1. Defining a keyboard shortcut for this macro. I.e. something like
[Ctrl-Shift-V]
2. Making it so that if I "Undo" after calling this macro, it would
undo the entire macro in one step, instead of stepping back through
all of the stages of the macro one by one.
Anyway, please use this at your own risk, I am not a VBA programmer!
And if anyone has any improvements, please feel free to post a
modified version.

thanks,
adamk

--------------------------------------------------------------------------------
Sub PasteAsQuotation()
'
' Implement "Paste as Quotation" for Outlook 2007
'
' Handles word-wrapping and multiple levels of quotation
'

' Declare all variables used in the function
Dim objDoc As Word.Document
Dim objSel As Word.Selection
Dim lineLength, startOfPaste, endOfPaste As Long
Dim quoteString, quoteDetect, multiQuote As String
Dim skipQuote, skipSpace, unitsMoved As Long
Dim foundQuote, wrapOccurred As Boolean

' Ignore errors!
On Error Resume Next

' Set hardcoded parameter values
lineLength = 72 ' Define the line length for word-wrapping
quoteString = ">" ' The character to use for quoting
quoteDetect = ">!" ' The characters to detect as quoting

' Get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection

' Paste the text from the clipboard
startOfPaste = objSel.Start
objSel.Paste
endOfPaste = objSel.Start
objSel.Start = startOfPaste
objSel.End = startOfPaste

' Walk through the pasted text adding appropriate quote
characters:
' If there is already one or more quote characters on the line
(followed by a space),
' then add another quote character, but no space, and don't do any
wrapping.
' If there aren't any quote characters already, then add a quote
character followed by a space,
' and wrap the text if necessary.
wrapOccurred = False
While objSel.Start < endOfPaste
foundQuote = False
If wrapOccurred = False Then
' Search for an existing quote sequence at the start of
the line
skipQuote = objSel.MoveEndWhile(Cset:=quoteDetect,
Count:=wdForward)
If skipQuote > 0 Then
skipSpace = objSel.MoveEndWhile(Cset:=" ", Count:=1)
If skipSpace = 1 Then
' Only a series of quote characters followed by a
space is treated as an existing quote
foundQuote = True
End If
End If
objSel.Collapse Direction:=wdCollapseStart
End If

' Now add the quote character and a space if necessary
objSel.TypeText Text:=quoteString
If foundQuote = False Then
objSel.TypeText Text:=" "
End If

' Now move to the start of the next line, wrapping if
necessary
wrapOccurred = False
If foundQuote = False Then
' If the line is going to be too long, then word wrap
unitsMoved = objSel.MoveUntil(Cset:=vbCrLf,
Count:=(lineLength - (Len(quoteString) + 1)))
If unitsMoved = 0 Then
objSel.Move Unit:=wdCharacter, Count:=(lineLength -
(Len(quoteString) + 1))
objSel.MoveUntil Cset:=" ", Count:=wdBackward
objSel.TypeText Text:=vbCrLf
wrapOccurred = True
Else
objSel.Move Unit:=wdCharacter, Count:=1
End If
Else
objSel.MoveUntil Cset:=vbCrLf, Count:=wdForward
objSel.Move Unit:=wdCharacter, Count:=1
End If
Wend
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top