ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying Word text to Excel (https://www.excelbanter.com/excel-programming/320627-copying-word-text-excel.html)

quartz[_2_]

Copying Word text to Excel
 
I have a program that copies text from Word into Excel.

I've tried copying the text into a string and writing that into Excel;
I've tried copying the Word text into the clipboard and pasting into Excel;

Either way, the text is a mess when it comes in and I can't seem to get it
very clean. Does anyone have a function or method for doing this cleanly? Is
it even possible?

The text is not highly formatted (only some bold). Thanks much in advance
for your suggestions.

Sharad Naik

Copying Word text to Excel
 
Try this:

dirtyStr = 'Assing this to the text from the WinWord
clnStr = Application.WorksheetFunction.Clean(dirtyStr)
Worksheets("Sheet1").Range("A1").Value = clnStr

Sharad

"quartz" wrote in message
...
I have a program that copies text from Word into Excel.

I've tried copying the text into a string and writing that into Excel;
I've tried copying the Word text into the clipboard and pasting into
Excel;

Either way, the text is a mess when it comes in and I can't seem to get it
very clean. Does anyone have a function or method for doing this cleanly?
Is
it even possible?

The text is not highly formatted (only some bold). Thanks much in advance
for your suggestions.





All times are GMT +1. The time now is 11:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com