Thread: [Solved] Rename File
View Single Post
 
Old 02-24-2011, 08:03 PM
cksm4 cksm4 is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Aug 2010
Posts: 48
cksm4 is on a distinguished road
Default Rename File

Hello,

I am trying to rename the active document using this code:

Code:
 
Sub RenameFile()
     Dim sOldPathName As String
     sOldPathName = "G:\DATA\Test.docx"
     On Error Resume Next
     Name sOldPathName As "G:\DATA\TestWorked.docx"
     If Err Then MsgBox Err.Description
End Sub
I get this error: "File/Path access error". Is it not possible to rename a open file?

Much thanks for any insite anyone can provide... I have spent a lot of time researching this.

Brock
Reply With Quote