View Single Post
 
Old 11-08-2020, 12:56 AM
alex100 alex100 is offline Windows 7 64bit Office 2016
Advanced Beginner
 
Join Date: May 2020
Posts: 79
alex100 is on a distinguished road
Default Replicate the copy/paste function, without involving the clipboard

I am using the following code to save some content, then write it to another location inside the document.

Code:
Dim content As String
content = Selection.Text

Selection.TypeText (content)
The problem is the written content no longer preserves the format of the original one. For example, in case of text content, it only saves the text, but without preserving its font size, color, shading, etc. Beside text, the content can also contain images and tables.

So what I need is to replicate the functionality of the copy/paste function, but without messing up the clipboard content (which would happen if I would use the 'Selection.Copy' and then the 'Selection.Paste' instructions).

Alex
Reply With Quote