#1
|
|||
|
|||
Macro for copying in clipboard more than one selected text
I'm making a VBA - Outlook macro but need to put in clipboard more than one selected text
ex: My open email is: Hi, this is the new article for commerce and name is Umbrella if I the word "COMMERCE" and "UMBRELLA" and click on a macro button, they should put in a clipboard: I have a vba code, but it takes only the word Umbrella. Could you please help me? Thanks so much Public Sub CopyTextToClipBoard() Dim objItem As Object Dim objInsp As Outlook.Inspector Dim objWord As Word.Application Dim objDoc As Word.Document Dim objSel As Word.Selection Dim oData As MSForms.DataObject Dim Word As Variant Dim taken As Variant Dim i As Integer ' Reference the current Outlook item Set objItem = Application.ActiveInspector.CurrentItem If Not objItem Is Nothing Then If objItem.Class = olMail Then Set objInsp = objItem.GetInspector If objInsp.EditorType = olEditorWord Then Set objDoc = objInsp.WordEditor Set objWord = objDoc.Application Set objSel = objWord.Selection Set oData = New MSForms.DataObject oData.SetText objSel.Text oData.PutInClipboard oData.GetFromClipboard taken = oData.GetText i = i + 1 MsgBox (taken) End If End If End If Set objItem = Nothing Set objWord = Nothing Set objSel = Nothing Set objInsp = Nothing NotText: If Err <> 0 Then MsgBox "Data on clipboard is not text." End If End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to extract selected hyperlink address to clipboard? | poetofpiano | Word VBA | 8 | 02-18-2018 07:17 PM |
Macro to find text in between two characters and then format selected text? | qcom | Word | 5 | 02-19-2015 11:23 PM |
Copying Selected Text Between Word Documents | Iluvatar343 | Word VBA | 1 | 06-05-2014 05:15 AM |
Find & selected paras with highlighted text & copy to clipboard | marceepoo | Word VBA | 1 | 09-14-2012 08:20 PM |
Macro Delete Selected Text | smonczka | Word VBA | 2 | 11-05-2011 03:18 AM |