Convet .doc into .txt

A

Anna

Hi:
I am trying to convert the .doc file into .txt from Access. File
convert one by one works fine but when i try to convert a bunch of
file, it gives syntax error "Invalid Procedure call or argument" but it
convert one file.

Error Line
--------------
sFile = Dir

Module
----------
Public Sub DocToTxt(ByVal sDocTxtFile As String, ByVal sTxtFile As
String)
Dim wdApp As Object
Set wdApp = CreateObject("Word.Application")
If Dir$(sTxtFile) <> "" Then Kill sTxtFile
wdApp.Documents.Open sDocTxtFile
' wdApp.ActiveDocument.SaveAs sTxtFile, 2, False, "", False, "",
False, False, False, False, False, 1252, False, False, 0,

False
wdApp.ActiveDocument.SaveAs sTxtFile, 2
wdApp.Quit
Set wdApp = Nothing
End Sub


Button in form
---------------
Private Sub Command43_Click()
sFile = Dir$("S:\Shared Services\PPVTEST\*.doc")
Do While sFile <> ""
sFile = LCase$(sFile)
DocToTxt "S:\Shared Services\PPVTEST\" & sFile, "S:\Shared
Services\PPVTEST\" & Replace(sFile, ".doc", ".txt")
sFile = Dir
Loop

'DocToTxt "C:\PPVTest\findings.doc", "c:\PPVTest\f.txt"
End Sub

Thanks.
 
Top