Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
SaveAs Text
Hello,
I would like to write an Excel VB script to save a word file as plain text type format thank you |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro syntax: SaveAs Filename=ActiveCell.Text . BUT to a specified folder | Excel Programming | |||
runtime error 1004 saveas text file | Excel Programming | |||
SaveAs text file from VBA Getting Error | Excel Programming | |||
saveas fixed text for unix | Excel Programming |