Hello All,
I am trying to use OLE to simply open a RTF document.....add 5 carriage returns and then save the document. The SourceChangeRTF.rtf document attached comes from another software package that I cannot change. What I am wanting to do is open the document (without viewing it)....put in 5 carriage returns to space everything in the RTF Document down 5 lines so that when I merge this document with another that contains the proper header information - all of the spacing will work out properly. What I don't understand is....if I open the RTF document attached and just hit enter 5 times - everything moves down as I want. But, if I seemingly do the same thing use OLE (see code below). The cursor starts in the table instead of the page and the 5 carraige returns entered in the OLE code just makes the first line of the table (blue header in attachments) space down - which is not what I want.
Any help would be greatly appreciated.
Regards,
Jeff
Added Later:
I don't actually need to use OLE I guess, if this could somehow be done with Alpha's file/string functions...that would be cool too. I could not see a way to do that however.
I am trying to use OLE to simply open a RTF document.....add 5 carriage returns and then save the document. The SourceChangeRTF.rtf document attached comes from another software package that I cannot change. What I am wanting to do is open the document (without viewing it)....put in 5 carriage returns to space everything in the RTF Document down 5 lines so that when I merge this document with another that contains the proper header information - all of the spacing will work out properly. What I don't understand is....if I open the RTF document attached and just hit enter 5 times - everything moves down as I want. But, if I seemingly do the same thing use OLE (see code below). The cursor starts in the table instead of the page and the 5 carraige returns entered in the OLE code just makes the first line of the table (blue header in attachments) space down - which is not what I want.
Code:
Dim wordApp as P Dim wordDoc as P wordApp = ole.Create("Word.Application") wordApp.WindowState = 0 'wdWindowStateMaximize wordApp.Documents.Open("C:\SourceChangeRTF.rtf") wordApp.Selection.InsertBefore(chr(13)+chr(13)+chr(13)+chr(13)+chr(13)) wordApp.ActiveDocument.SaveAs("C:\ResultChangeRTF.rtf",0) ' 0 is a Word Document ' 4 is a text file WordApp.Quit() delete wordDoc delete wordApp
Regards,
Jeff
Added Later:
I don't actually need to use OLE I guess, if this could somehow be done with Alpha's file/string functions...that would be cool too. I could not see a way to do that however.
Comment