I use a VBA-enhanced Word document to convert a plain text file without page breaks into a Word document with page breaks. Formerly, the VBA code I use would only make one copy of the converted file, but to gain a little bit of archival security I duplicated the SaveAs code to save an extra copy with a date-stamped filename. The code works but the two ‘identical’ files are completely different sizes. The date-stamped copy is 153KB versus the plain-named copy’s 94KB. The subsequent code does nothing to either modify or save the file.
I’m slightly confused — I would expect, and would much rather have, absolutely identical files. Is the second (DOC to DOC) file getting compressed, whereas the first (TXT to DOC) has some bloat left in it from the conversion?
Documents.Open FileName:="DOLLY.TXT", ConfirmConversions:=False, _ ReadOnly:=True, AddToRecentFiles:=False, PasswordDocument:="", _ PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _ WritePasswordTemplate:="", Format:=wdOpenFormatAuto With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = "LOCATION" .Replacement.Text = "^mLOCATION" .Forward = True .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll End With Selection.Delete Unit:=wdCharacter, Count:=1 ChangeFileOpenDirectory "C:ApplicationsDolly" ActiveDocument.SaveAs FileName:="DOLLY" & " " & Format(Now(), "YYMMDD") & ".DOC", _ FileFormat:=wdFormatDocument, LockComments:=False, Password:="", _ AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _ EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _ SaveAsAOCELetter:=False ActiveDocument.SaveAs FileName:="DOLLY.DOC", _ FileFormat:=wdFormatDocument, LockComments:=False, Password:="", _ AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _ EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _ SaveAsAOCELetter:=False Application.Documents("DollyConvert.doc").Close Application.ScreenUpdating = True