Delete original file

S

Steve C

I am writing a procedure that allows a user to update all the Word documents
in a selected folder with new information. In the process, I want each
document to be saved under a new name (which I know how to do) , but also
delete the old document.

Part of my code is as follows:
ChangeFileOpenDirectory PathToUse 'determined earlier in code

ActiveDocument.SaveAs FileName:=NewDocName, FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False

Of course, what I end up with in the chosen folder is all of the original
documents, plus their newly saved updated versions. How do I tell Word
during the Save As process to get rid of the original file? Thanks much!
 
D

Doug Robbins - Word MVP

Use the Kill command. Check out the Visual Basic Help file for the syntax
to use.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

Steve C

That's what I needed, Doug. Thanks!
--
Steve C


Doug Robbins - Word MVP said:
Use the Kill command. Check out the Visual Basic Help file for the syntax
to use.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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