Microsoft Office Forums Macro for copying in clipboard more than one selected text

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-31-2019, 07:47 AM
ghostwhisperer86 ghostwhisperer86 is offline Macro for copying in clipboard more than one selected text Windows 10 Macro for copying in clipboard more than one selected text Office 2016
Novice
Macro for copying in clipboard more than one selected text
 
Join Date: Mar 2019
Posts: 1
ghostwhisperer86 is on a distinguished road
Default 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
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for copying in clipboard more than one selected text How to extract selected hyperlink address to clipboard? poetofpiano Word VBA 10 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
Macro for copying in clipboard more than one selected text Find & selected paras with highlighted text & copy to clipboard marceepoo Word VBA 1 09-14-2012 08:20 PM
Macro for copying in clipboard more than one selected text Macro Delete Selected Text smonczka Word VBA 2 11-05-2011 03:18 AM


All times are GMT -7. The time now is 09:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft