Anyone know of a com object or something that can export unformatted text from a microsoft word documnt (.doc)?
Thanks
Printable View
Anyone know of a com object or something that can export unformatted text from a microsoft word documnt (.doc)?
Thanks
VB Code:
Function DocText(ByVal DocName As String) As String ' Author: WorkHorse ' Purpose: Read Microsoft Word document text. ' In: Microsoft Word document file name. ' Out: Text of the Word document. ' Notes: Document text returned includes revision marking text. Dim lngHandle As Long ' Handle for free file. On Error Resume Next ' Read file. Read as binary to read past End Of File characters. lngHandle = FreeFile Open DocName For Binary As #lngHandle DocText = Input(LOF(1), #lngHandle) Close #lngHandle ' Parse document text from file. ' Document text starts at character 1537. ' Document text ends at the first following null. DocText = Mid$(DocText, 1537, (InStr(1537, DocText, Chr$(0))) - 1537) ' Convert carriage returns (paragraph marks) ' to carriage return & line feed. DocText = Replace(DocText, vbCr, vbCrLf) End Function
Damn why didn't i think of that!
Next time I will beat myself before I ask for help on a simple problem.
good thing workhorse thought of it then :)Quote:
Originally posted by nkad
Damn why didn't i think of that!
Next time I will beat myself before I ask for help on a simple problem.
I would like to note that I just found out this code will only work with Microsoft Word 9.0 (office 2000) not Word 10.0 (Office XP)
Need to look up the header offset for the version number and then seek to the correct byte offset.
Great if you could post the solution once you find it :)
Nkad
Did you ever find the offset for the header on Word 10?
Thanks
David