Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2015, 08:38 AM
gmaxey gmaxey is offline Keep text selected after paste Windows 7 32bit Keep text selected after paste Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

If you don't need special paste features you might use a simple macro:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
  Dim oRng As Word.Range
  Set oRng = Selection.Range
  oRng.Paste
  oRng.Select
End Sub

__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #2  
Old 07-20-2018, 07:46 AM
joelraffel joelraffel is offline Keep text selected after paste Windows XP Keep text selected after paste Office 2003
Novice
 
Join Date: Jul 2018
Posts: 1
joelraffel is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
If you don't need special paste features you might use a simple macro:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
  Dim oRng As Word.Range
  Set oRng = Selection.Range
  oRng.Paste
  oRng.Select
End Sub

The above works well Greg, thanks. As you say, this only works with 'normal paste'. I need the above to work with a special paste. Is this possible?

I often copy text from pdf and paste into word. I want a single macro which can:
- do a 'MergeFormatting' paste into Word, and then
- have this pasted text automatically selected, and then
- I will add more to the macro, including a way to replace unwanted paragraphs with spaces (already described by others, and I already have this code).

Any help would be MUCH appreciated!
Reply With Quote
  #3  
Old 07-31-2019, 05:34 AM
ours_paresseux ours_paresseux is offline Keep text selected after paste Windows 7 64bit Keep text selected after paste Office 2010
Novice
 
Join Date: Jul 2019
Posts: 2
ours_paresseux is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
If you don't need special paste features you might use a simple macro:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
  Dim oRng As Word.Range
  Set oRng = Selection.Range
  oRng.Paste
  oRng.Select
End Sub

Thank you Greg, this is very helpful and solved the same problem that I was having.
Please could you break down the code so I can understand what each part means? I am new to vba. Thanks!
Reply With Quote
  #4  
Old 01-08-2021, 01:56 AM
davidswb davidswb is offline Keep text selected after paste Windows 10 Keep text selected after paste Office 2019
Novice
 
Join Date: Jan 2021
Posts: 2
davidswb is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
If you don't need special paste features you might use a simple macro:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
  Dim oRng As Word.Range
  Set oRng = Selection.Range
  oRng.Paste
  oRng.Select
End Sub
Hi Greg,
For the macro belwo you once posted is there a way to do the same thing using PasteSpecial (unformated text) with the Select at the end? I've been trying and have not any success.

Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Set oRng = Selection.Range
oRng.Paste
oRng.Select
End Sub

Many thanks
David
Reply With Quote
Reply

Tags
copy and paste, text selection

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to find text in between two characters and then format selected text? qcom Word 5 02-19-2015 11:23 PM
Keep text selected after paste Getting mult resps. selected in listbox to concatenate & paste at a bookmark in Word marksm33 Word VBA 3 01-15-2015 05:59 PM
Keep text selected after paste Formatting affecting more than selected text esteban Word 7 05-25-2012 04:34 AM
Keep text selected after paste Do NOT print selected text Tracy Word 2 09-11-2011 07:25 AM
Selected text and logo in one macro marijke Word VBA 0 08-24-2009 07:01 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:47 AM.


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