Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-20-2023, 06:59 AM
ctviggen ctviggen is offline Pasting in text like Notepad (not Paste Special) Windows 10 Pasting in text like Notepad (not Paste Special) Office 2016
Advanced Beginner
Pasting in text like Notepad (not Paste Special)
 
Join Date: Feb 2021
Posts: 54
ctviggen is on a distinguished road
Default Pasting in text like Notepad (not Paste Special)

I am trying to use VBA for many repetitive tasks performed by our organization. One of those involves copying and then pasting in text, and then processing that pasted-in text.



The text that we would be copying looks like this:

1. Some text (multiple lines of text, wherein only the first line is numbered)...

2. The text of 1, wherein...(again, only the first line has a number)
We use Word Styles for this:
- The numbered paragraphs are one style
- The non-numbered paragraphs that follow the numbered paragraphs are a different style.



Manually performing this, I typically copy this text, then use a program called Pure Text, which essentially operates as Notepad does: That is, the "1.", "2." that begin the first lines are included.



Thus, when I manually paste this in (using a keystroke devoted to Pure Text), the numbers are there. (I could copy, paste into Notepad, copy all, then paste into Word and get the same result.)



Trying to implement this in VBA, however, if I perform a Paste Special, then Text Only, the numbers are not there. In VBA, this is what I am using:

Selection.PasteSpecial Link:=False, DataType:=wdPasteText, Placement:= _
wdInLine, DisplayAsIcon:=False
This does not paste in the numbers ("1.", "2."...).



Using VBA, is there a way to paste in a way that acts like Notepad does?





If that is not possible, is it possible to access the clipboard (I assume this is where the text is stored before pasting it?) and then get those numbers or otherwise process what is in the clipboard so that I can retain those numbers?


Ideally, I would not use text and would instead convert from one Word style to another. However, not everyone uses the same styles, and I'm concerned the level of programming it would take to operate with different styles would be too complex.



Thank you.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Notepad to Word : Pasting Specific text ie between any two blank line from notepad to word SMehta Word VBA 27 02-03-2021 03:34 AM
Pasting in text like Notepad (not Paste Special) Copy text with tab at start of line and paste to Notepad JohnTurnbull Word 5 08-27-2017 11:17 PM
need a shortcut for paste special link unformatted text noetic76 Word VBA 2 06-29-2014 06:40 PM
Pasting in text like Notepad (not Paste Special) Paste Special: Copy and Paste Formatting Only? tinfanide Word 6 03-06-2013 12:21 AM
Pasting in text like Notepad (not Paste Special) Paste Special Unformatted Text kenwpaul Office 2 02-25-2011 04:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:13 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