Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Save rich text somewhere in Excel?

Suppose I open a Word document full of rich text with colors and bold text, etcetera. Then I highlight everything with Ctrl-A and copy it into the clipboard with Ctrl-C.

Now, can I paste this rich text into a spreadsheet cell or somewhere in an Excel document and still retain all the rich text properties? If I have rich text stored somewhere in an Excel file, I'd like to create a macro that copies that rich text back into the clipboard. I know the command/functions for copying data into the clipboard using VBA. I just don't know how to store rich text in an Excel file.

Any ideas?

-Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Save rich text somewhere in Excel?

"RG III" wrote in message

Suppose I open a Word document full of rich text with colors and bold text,
etcetera. Then I highlight everything with Ctrl-A and copy it into the
clipboard with Ctrl-C.

Now, can I paste this rich text into a spreadsheet cell or somewhere in an
Excel document and still retain all the rich text properties? If I have
rich text stored somewhere in an Excel file, I'd like to create a macro that
copies that rich text back into the clipboard. I know the command/functions
for copying data into the clipboard using VBA. I just don't know how to
store rich text in an Excel file.

Any ideas?

-Robert

--------------------------------------------------------------

Try PasteSpecial HTML

Peter T


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Save rich text somewhere in Excel?

On Saturday, September 14, 2019 at 2:01:33 AM UTC-7, Peter T wrote:

Try PasteSpecial HTML


This might work, except that it pastes each paragraph in a different row.

Now I just need to create a macro that reassembles the rich text into it's original single glob and copies it back into the clipboard.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Save rich text somewhere in Excel?


Try PasteSpecial HTML


Well, that does paste rich text into multiple Excel cells. Now I'm stuck trying to figure out how to copy the rich text from an Excel cell back into the clipboard in it's original rich text form.

Do you have any ideas?

-Robert

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Save rich text somewhere in Excel?


"RG III" wrote in message


Try PasteSpecial HTML


Well, that does paste rich text into multiple Excel cells. Now I'm stuck
trying to figure out how to copy the rich text from an Excel cell back
into the clipboard in it's original rich text form.

Do you have any ideas?

-Robert


Nothing to do. By default when you copy from in Excel it copies to the
clipboard in a variety of 'clipboard formats' in including rich text and
HTML. There are different options for copying graphics.

If pasting back into Word could use paste-special rich-text (n/a in Excel)
but theme colours will get pasted as RGB's not necessarily the same. Also
the L/R margins will adjust to the cell width but easy enough to adjust. But
try pastespecial HTML again in Word. In other apps paste will get from the
clipboard in the app's default format.

Peter T





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Save rich text somewhere in Excel?


"RG III" wrote in message

On Saturday, September 14, 2019 at 2:01:33 AM UTC-7, Peter T wrote:

Try PasteSpecial HTML


This might work, except that it pastes each paragraph in a different row.

Now I just need to create a macro that reassembles the rich text into it's
original single glob and copies it back into the clipboard.


Adjust the columnwidth to same as the Word doc's margins. Format with
word-wrap, if necessary 'AutoFit' row heights.

Peter T


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Save rich text somewhere in Excel?

On Saturday, September 14, 2019 at 4:48:35 AM UTC-7, Peter T wrote:

Nothing to do. By default when you copy from in Excel it copies to the
clipboard in a variety of 'clipboard formats' in including rich text and
HTML. There are different options for copying graphics.

If pasting back into Word could use paste-special rich-text (n/a in Excel)
but theme colours will get pasted as RGB's not necessarily the same. Also
the L/R margins will adjust to the cell width but easy enough to adjust.
But pastespecial HTML again in Word. In other apps paste will get from
the clipboard in the app's default format.


Sorry if I wasn't clear. But I was looking for VBA macro code that copied the rich text from a cell back into the clipboard.

I think I found a solution though. If cell A1 contains pre-pasted rich text consisting of colors, underlines, and bold text in cell A1, then the following code should copy the rich text back into the clipboard:

Range("A1").Select ' Grab the rich text
Selection.Copy ' Now send it to the clipboard
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Save rich text somewhere in Excel?

"RG III" wrote in message
On Saturday, September 14, 2019 at 4:48:35 AM UTC-7, Peter T wrote:

Nothing to do. By default when you copy from in Excel it copies to the
clipboard in a variety of 'clipboard formats' in including rich text and
HTML. There are different options for copying graphics.

If pasting back into Word could use paste-special rich-text (n/a in
Excel)
but theme colours will get pasted as RGB's not necessarily the same. Also
the L/R margins will adjust to the cell width but easy enough to adjust.
But pastespecial HTML again in Word. In other apps paste will get from
the clipboard in the app's default format.


Sorry if I wasn't clear. But I was looking for VBA macro code that copied
the rich text from a cell back into the clipboard.

I think I found a solution though. If cell A1 contains pre-pasted rich
text consisting of colors, underlines, and bold text in cell A1, then the
following code should copy the rich text back into the clipboard:

Range("A1").Select ' Grab the rich text
Selection.Copy ' Now send it to the clipboard


That's simply a normal copy, like selecting A1 and Ctrl-C

FWIW for most operations with VBA there's no need no need to select or
activate anything, eg

Dim rng As Range
Set rng = Range("A1")
rng.Copy

Peter T


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rich text formatting gone in Excel 2007? John[_140_] Excel Programming 7 February 25th 09 02:40 AM
Rich Text box GS80 Excel Programming 4 March 18th 08 10:00 AM
Rich Text Box kirkm[_7_] Excel Programming 5 March 10th 08 01:35 PM
Rich Text Box Randall[_5_] Excel Programming 0 April 30th 05 05:56 PM
Problem with Excel using a .Net rich text box Esteban404 Excel Programming 1 July 15th 04 04:00 PM


All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"