Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename Word doc 1

Status
Not open for further replies.

bill420

IS-IT--Management
Oct 12, 2005
23
US
I need to rename a Word doc using VBA in Access. I have been able to open the existing file and save as the new name,
Code:
If strAgent <> Me.Combo15 Then
        Set WordInst = CreateObject("word.application")
        WordInst.Documents.Open ("C:\Access\Folder1\" & strAgent & ".doc")
        WordInst.ActiveDocument.RenameAs ("C:\Access\Folder1\" & Me.Combo15 & ".doc")
        WordInst.Visible = True
        WordInst.Quit
        Set WordInst = Nothing  
End If
however I am left with the original doc.
Is there a way to simple rename the doc or to delete the original?
Bill
 
Would Name As suit?

[tt]Name "C:\Docs\ThisDoc.Doc" As "C:\Docs\NewName.Doc"[/tt]
 
Thanks Remou,
Name As worked GREAT.
Thanks so much.
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top