Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extract attachments

Status
Not open for further replies.

australia3

Technical User
Nov 9, 2004
64
GB
I noticed a similar archived thread 73-1018312.Any ideas How can I extract attachments (MS Word)from multiple documents and save them to our file server?
 
I'll give it a try though using compacted (pseudo) LS , based on certain assumptions:
- All files can be stored to a common area on a server
- All documents are available within the same database
- Objects for finding the docs allocated (view and / or db)
- Document collection already allocated through view or DBSearch...

...
Set doc = doccoll.GetFirstDocument()
Dim FileName as String
Dim ServerFilePath as String
ServerFilePath$ = "\\ServerName\ServerShare\"
On Error Resume Next ' This one is a bit 'dangerous', should be a better error handler. Included mainly because of the 'ExtractFile' method
While (Not (doc is nothing)) then
if (Doc.HasEmbedded) then
ForAll fileobj In doc.EmbeddedObjects
FileName = fileobj.Source
if (instr(1, FileName, ".doc", 5) > 0) then 'Assume it IS a word document
Call fileobj.ExtractFile(ServerFilePath$ + FileName$)
end if
End ForAll
end if
Set doc = doccoll.GetNextDocument(doc)
Wend
...

Some minor adjustments must be expected but it should not be to far off the wanted result...




Brgds,

TrooDOS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top