#1
|
|||
|
|||
send a string from Excel UserForm to Word
Hello, I am in Excel VBA UserForm. I have a long string text containing lots of chr(10) and chr (13) and I need to sent this string to a Word file. However after I sent I found lots of blank lines in the Word document and I had to manually "select all" and do "reduce the space between rows". Later I added a code to select the whole text in Word, but I don't know how to use "WholeStory" function to delete all these blank rows in the selected text. My code is as below (in Excel VBA):
Private Sub ScopeSendToWord Dim objWordFile As Word.Application Set objWordFile = New Word.Application objWordFile.Documents.Add objWordFile.ActiveDocument.Range.Text = txtScope (txtScope is a string text which I want to export to a Word file, the code works and I can see the content in Word file) objWordFile.ActiveDocument.Range.Select (selecting text in Word file) Selection.WholeStory (this is the code I added but I can't get through and I need help) objWordFile.Visible=True End Sub Thank you so much. Jason |
#2
|
||||
|
||||
See my reply in your other thread: https://www.msofficeforums.com/word-...ry-method.html
Please don't post the same question in multiple forums. Thread closed.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Way to search for a string in text file, pull out everything until another string? | omahadivision | Excel Programming | 12 | 11-23-2013 12:10 PM |
Excel Fomula to search for a string and display value from different column | zeeshanbutt | Excel | 1 | 07-29-2012 12:48 AM |
How to link userform to another word document | SaneMan | Word VBA | 5 | 10-14-2011 05:12 AM |
VBA code to update record in Access 2003 using Userform in Excel | primmer3001 | Excel Programming | 0 | 08-29-2011 04:25 PM |
cant send email directly from WORD (or excel) | etodem | Word | 0 | 04-03-2009 04:59 PM |