So what I am trying to do is take a word document, save it as a plaint text .txt with the line breaks enabled. I was told a macro would be an easy way to do this, and I've had some success. My biggest problem right now is that it is not saving the document as it's current file name. I looked around and people have said to use ActiveDocument.Name, but for some reason that's not working for me and I end up with the document saved as a txt file but literally named ActiveDocument.Name. This is my first attempt at anything VBA related, so it's probably some simple little syntax error that I can't see. Here's my current code:
Sub WordtoTxtwLB()
'
' WordtoTxtwLB Macro
'
'
ActiveDocument.SaveAs2 FileName:= _
"\\Path\Path\FILENAME.txt", FileFormat:= _
wdFormatText, LockComments:=False, Password:="", AddToRecentFiles:=True, _
WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False, Encoding:=1252, InsertLineBreaks:=True, AllowSubstitutions:=False, _
LineEnding:=wdCRLF, CompatibilityMode:=0
End Sub
Note: I did change the path and file name in my code to generic ones (i.e. 'Path' and 'FILENAME') just to make things a little easier/clearer. SO if I had a document called cat.doc, I would want the macro to save it as a .txt file with line breaks and with the same file name. Any help/suggestions?