Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-04-2024, 02:51 AM
yacov yacov is offline paste from clipboard to selected paragraphs Windows 10 paste from clipboard to selected paragraphs Office 2016
Competent Performer
paste from clipboard to selected paragraphs
 
Join Date: Oct 2019
Posts: 139
yacov is on a distinguished road
Default paste from clipboard to selected paragraphs

Hi.


1. Is there a wildcard command to paste from the clipboard for the beginning of each selected paragraphs (only for the paragraphs I selected).
2. And another command, paste to the end of each selected paragraph/

thanks.
Reply With Quote
  #2  
Old 02-04-2024, 06:52 AM
vivka vivka is offline paste from clipboard to selected paragraphs Windows 7 64bit paste from clipboard to selected paragraphs Office 2016
Competent Performer
 
Join Date: Jul 2023
Posts: 227
vivka is on a distinguished road
Default

Hi, yacov! If I understand your task correctly, try the following.
Pasting at paragraphs' starts

Technique 1 (manual, I'm sure you know it):
select & copy what you want using Ctrl+A, then place the cursor at the start of each paragraph & press Ctrl+V;
Technique 2 (using a macro):
select & copy what you want using Ctrl+A, then select the paragraphs to paste to & run the following macro:
Code:
Sub Paras_Paste_Start()
Dim Rng As range
Dim oPar As Paragraph
    
    Application.ScreenUpdating = False
    Set Rng = selection.range
    For Each oPar In Rng.Paragraphs
        oPar.range.InsertBefore vbCr & Chr(32)
        oPar.range.Previous.Paste
    Next oPar
Application.ScreenUpdating = False
Set Rng = Nothing
 End Sub
Pasting at paragraphs' ends:
Code:
Sub Paras_Paste_End()
Dim Rng As range
Dim oPar As Paragraph

    Application.ScreenUpdating = False
    Set Rng = selection.range
    For Each oPar In Rng.Paragraphs
        oPar.range.Characters.Last.InsertBefore Chr(32)
        oPar.range.Characters.Last.Previous.Paste
    Next oPar
Application.ScreenUpdating = False
Set Rng = Nothing
 End Sub
If this is not what you want, be more specific.
Reply With Quote
  #3  
Old 02-04-2024, 08:30 AM
yacov yacov is offline paste from clipboard to selected paragraphs Windows 10 paste from clipboard to selected paragraphs Office 2016
Competent Performer
paste from clipboard to selected paragraphs
 
Join Date: Oct 2019
Posts: 139
yacov is on a distinguished road
Default

Thank you very much Vivka.

The second macro (for the end of the paragraph) works fine.

The first macro gives me an extra paragraph. Instead of the pasting being in the selected paragraph, it actually creates another paragraph. but i can fix it by hand. so if it is hard to fix the macro i will manage like that.

thanks again.
Reply With Quote
  #4  
Old 02-04-2024, 10:38 AM
vivka vivka is offline paste from clipboard to selected paragraphs Windows 7 64bit paste from clipboard to selected paragraphs Office 2016
Competent Performer
 
Join Date: Jul 2023
Posts: 227
vivka is on a distinguished road
Default

It's strange, because with me the 1st macro works properly. Anyway, try this one:
Code:
Sub Paras_Paste_Start()
Dim Rng As range
Dim oPar As Paragraph
    
    Application.ScreenUpdating = False
    Set Rng = selection.range
    For Each oPar In Rng.Paragraphs
        oPar.range.InsertBefore Chr(32) & Chr(32)
        oPar.range.Characters.First.Paste
    Next oPar
Application.ScreenUpdating = False
Set Rng = Nothing
End Sub

Last edited by vivka; 02-04-2024 at 01:42 PM.
Reply With Quote
  #5  
Old 02-04-2024, 11:31 AM
yacov yacov is offline paste from clipboard to selected paragraphs Windows 10 paste from clipboard to selected paragraphs Office 2016
Competent Performer
paste from clipboard to selected paragraphs
 
Join Date: Oct 2019
Posts: 139
yacov is on a distinguished road
Default

works good thanks a lot.
i use Ditto clipboard manager and when i turn it off there is
no extra paragraph with the macro.
Sorry I didn't know that at first.
Reply With Quote
  #6  
Old 02-04-2024, 01:41 PM
vivka vivka is offline paste from clipboard to selected paragraphs Windows 7 64bit paste from clipboard to selected paragraphs Office 2016
Competent Performer
 
Join Date: Jul 2023
Posts: 227
vivka is on a distinguished road
Default

You are welcome, Yacov!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
paste from clipboard to selected paragraphs Replicate the copy/paste function, without involving the clipboard alex100 Word VBA 8 11-09-2020 08:19 AM
Macro for copying in clipboard more than one selected text ghostwhisperer86 Outlook 0 03-31-2019 07:47 AM
paste from clipboard to selected paragraphs How to extract selected hyperlink address to clipboard? poetofpiano Word VBA 8 02-18-2018 07:17 PM
How to paste as a single para from clipboard having multiple paragraph PRA007 Word VBA 8 12-04-2015 04:48 AM
paste from clipboard to selected paragraphs Find & selected paras with highlighted text & copy to clipboard marceepoo Word VBA 1 09-14-2012 08:20 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:45 AM.


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