![]() |
|
|
|
#1
|
|||
|
|||
|
I'm not sure what one of your documents looks like when you initiate this code but why don't you take the spaces out before you ever put it in the clipboard?
Code:
Sub Macro18() Dim oClipboard As DataObject Dim oRng As Range 'This part gets a person's name from a Word document to the oClipboard. Selection.EndKey Unit:=wdStory Selection.MoveUp Unit:=wdLine, Count:=4 Selection.EndKey Unit:=wdLine, Extend:=wdExtend Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Set oRng = Selection.Range oRng.Text = Trim(oRng.Text) oRng.Copy Undo 1 'Put the spaces back in the text. lbl_Exit: Exit Sub End Sub |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Clipboard error Win10 Pro 64 | bkcell | Windows | 1 | 03-24-2018 04:20 AM |
| clipboard error freezes workbook | bkcell | Excel | 4 | 06-18-2017 08:00 PM |
| Do you want to keep your clipboard? | Cam-Bean | Word | 0 | 06-14-2017 02:55 AM |
| Getting the clipboard value: Dataobject error | arjfca | Word VBA | 0 | 12-04-2014 01:51 AM |
Get clipboard Image
|
janith | Word | 2 | 05-27-2012 07:33 AM |