Save a Word document as .txt from within Access

  • Thread starter Thread starter Carol Grismore
  • Start date Start date
C

Carol Grismore

Is there a way to save a Word document as a .txt file using VB code? I don't
want to ask my users to "save as" because they will be working with
thousands of documents on many different servers.
 
Hi

I assume you know how to automate Word from Access using VBA. If so, use the
SaveAs method,

e.g.

ActiveDocument.SaveAs FileName:="abc.txt", FileFormat:=wdFormatText

Cheers.

BW
 
Yep, tried that -- I bet you thought I gave you an easy one. The result is
not a .txt file. It looks like a .doc looks when you open it with Notepad.

Here's my code:

--------------------------------------------------------------------
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True

With WordApp
.Documents.Open "C:\Documents\file.doc"
Set WordDoc = WordApp.ActiveDocument

WordDoc.SaveAs _
FileName:="C:\Documents\file.txt", _
FileFormat:=wdFormatText

End With
 
Between us, we figgered it out. Your snip works, if the proper reference is
added to the project. I'm all set now, so thanks very much!
 
Back
Top