Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-24-2011, 08:03 PM
cksm4 cksm4 is offline Rename File Windows XP Rename File Office 2007
Advanced Beginner
Rename File
 
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
  #2  
Old 02-25-2011, 02:37 AM
macropod's Avatar
macropod macropod is offline Rename File Windows 7 32bit Rename File Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Brock,

No, you can't rename an open file.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-25-2011, 09:29 AM
cksm4 cksm4 is offline Rename File Windows XP Rename File Office 2007
Advanced Beginner
Rename File
 
Join Date: Aug 2010
Posts: 48
cksm4 is on a distinguished road
Default

Hey Paul,

Thanks for the reply... it answers my question! I will use the Kill command after the Name command to delete the old copy of the file. This will serve the same purpose. Thanks again Paul!

Brock
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Rename File Word Macro: Save file as text with current file name jabberwocky12 Word VBA 2 10-22-2010 12:23 PM
Rename File Rename Outlook 2003 Contacts Folder sfpermits Outlook 6 07-21-2010 09:56 AM
linking a word file and an excell file on a macbook pro Fleur Office 0 07-14-2010 08:19 PM
Rename File How to open ppt file directly with slide show when clicked on file. praveen_p PowerPoint 1 05-06-2009 12:42 PM
Rename File code to save / rename / send attachments unit213 Outlook 1 09-26-2007 08:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft