
Pastes table cells and overwrites existing table cells. Pastes an appended table without merging table styles. Inserts a pasted table as rows between two rows in the target table. Merges pasted cells into an existing table by inserting the pasted rows between the selected rows. Pastes a single cell table as a separate table.

Merges a pasted list with neighboring lists.Ĭontinues numbering of a pasted list from the list in the document. Matches the formatting of the pasted text to the formatting of surrounding text. WdFormatSurroundingFormattingWithEmphasis Preserves original formatting of the pasted material. Pastes an Excel chart and links it to the original Excel spreadsheet. Pastes a Microsoft Office Excel chart as an embedded OLE object. For more information see WdRecoveryType Enumeration (Word). Set objMail = Application.CreateItem(olMailItem)
#VBA COPYING TEXT CLIPBOARD HOW TO#
This sample shows how to paste the copied content into a new message: If objInsp.EditorType = olEditorWord Then ObjSel.PasteAndFormat (wdFormatOriginalFormatting)ĭon't forget to set a reference to Word's Object model in Tools, References. This sample copies the body of the selected message to the clipboard.

Use Word Object Model to Copy (and Paste)Ĭurrent versions of Outlook use Word as the email as the email editor and can use the Word object model library to do things not normally supported in Outlook. Set oMail = ActiveExplorer().Selection.Item(1) If its not listed, add C:\Windows\System32\FM20.dll or C:\Windows\FM20.dll as a reference. Remember, if you receive a "User-defined type not defined" you are missing the reference to Microsoft Forms 2.0 Object Library. What about going in the other direction: copying text to the clipboard? Use PutInClipboard to capture the text.

Mail.Subject = mail.Subject & " my text " & strPaste If you receive a "User-defined type not defined" you are missing the reference to Microsoft Forms 2.0 Object Library. Note, you will need to have a reference to the Forms library in Tools, References. The finished code will look something like the following.
