-
Jul 17th, 2003, 03:32 AM
#1
Thread Starter
Fanatic Member
Export text from .DOC? (Resolved)
Anyone know of a com object or something that can export unformatted text from a microsoft word documnt (.doc)?
Thanks
Last edited by nkad; Jul 17th, 2003 at 04:23 AM.
-
Jul 17th, 2003, 03:59 AM
#2
-= B u g S l a y e r =-
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
-
Jul 17th, 2003, 04:22 AM
#3
Thread Starter
Fanatic Member
Damn why didn't i think of that!
Next time I will beat myself before I ask for help on a simple problem.
-
Jul 17th, 2003, 04:24 AM
#4
-= B u g S l a y e r =-
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.
good thing workhorse thought of it then
-
Jul 19th, 2003, 05:03 AM
#5
Thread Starter
Fanatic Member
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.
-
Jul 19th, 2003, 11:08 AM
#6
-= B u g S l a y e r =-
Great if you could post the solution once you find it
-
Feb 4th, 2004, 10:38 PM
#7
Hyperactive Member
Nkad
Did you ever find the offset for the header on Word 10?
Thanks
David
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|