SaveAs Text
Hello,
I would like to write an Excel VB script to save a word file as plain text type format thank you |
SaveAs Text
Not that doing it from Excel is much different, but why aren't you writing
the macro in Word? I have this word macro Sub savetext() Dim fName As String fName = ActiveDocument.FullName fName = Left(fName, Len(fName) - 4) + ".txt" ActiveDocument.SaveAs FileName:=fName, FileFormat _ :=wdFormatText, LockComments:=False, Password:="", AddToRecentFiles:=True _ , WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _ False, SaveNativePictureFormat:=False, SaveFormsData:=False, _ SaveAsAOCELetter:=False End Sub It could be rewritten to work from Excel by creating a word object in excel and the referencing Word macro XLsaveWordText() Dim fName As String dim wordapp as object Set wordapp = CreateObject("Word.Application") fName = wordapp.ActiveDocument.FullName fName = Left(fName, Len(fName) - 4) + ".txt" wordapp.ActiveDocument.SaveAs FileName:=fName, FileFormat _ :=wdFormatText, LockComments:=False, Password:="", AddToRecentFiles:=True _ , WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _ False, SaveNativePictureFormat:=False, SaveFormsData:=False, _ SaveAsAOCELetter:=False End Sub I have not tested this from Excel but it should work. Peter Richardson "Dan" wrote: Hello, I would like to write an Excel VB script to save a word file as plain text type format thank you |
All times are GMT +1. The time now is 02:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com