Plain .TXT file to Word .DOC file via Excel VBA - Possible?

C

Charlotte E.

Well, the subject says it all :)

Plain .TXT file to Word .DOC file via Excel VBA - Possible?

If it's possible, could someone help me with the code?


TIA,

CE
 
J

Joel

This code will work. I'm using word to do the conversion, but running the
macro in Excel. Does that meet the requirements?

FName = "c:\temp\abc.txt"
WordFName = "c:\temp\abc.doc"

Set Wordobj = CreateObject("Word.Application")
Wordobj.Visible = True

Wordobj.Documents.Open Filename:=FName, _
ConfirmConversions:=False
Wordobj.activedocument.SaveAs Filename:=WordFName, _
FileFormat:=wdFormatDocument

Wordobj.Quit
 
C

Charlotte E.

Thanks, Joel :)

With a little modifications I got it to work, just as I wanted :)

CE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top