View Single Post
 
Old 02-10-2014, 07:51 PM
saltlakebuffalo saltlakebuffalo is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Feb 2014
Posts: 11
saltlakebuffalo is on a distinguished road
Default don't know how to use ".wholestory" method

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" method 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 here)
objWordFile.Visible=True
End Sub

Thank you so much.
Jason
Reply With Quote