Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Rich text formatting gone in Excel 2007? | Excel Programming | |||
Rich Text box | Excel Programming | |||
Rich Text Box | Excel Programming | |||
Rich Text Box | Excel Programming | |||
Problem with Excel using a .Net rich text box | Excel Programming |