View Full Version : [SOLVED:] Move an excel file to another folder
Does anyone have a code that will move an excel file from one server folder to another server folder? The path of the file will have a full path to include the file extension i.e. D\Timesheets\Smith, Jane K.xlsx. There are a number of codes on the web that make a copy and save a file to another folder but I can not find any code that will move a file from one folder to another.
Thank you for your help
mancubus
10-12-2016, 12:35 AM
:)
https://www.google.com.tr/#safe=active&q=excel+vba+move+a+file+from+one+folder+to+another
one from vbax:
http://www.vbaexpress.com/forum/showthread.php?47078-VBA-Code-to-move-files-to-another-folder
Name "D:\Timesheets\Smith, Jane K.xlsx" As "G:\OF\Smith, Jane K.xlsx"
Please use F1 in the VBEditor.
I am such a dunce; I am always forgetting to tell you pertinent information. All I need is to move an excel file from one folder location to another with a predetermined path of where the file is located and where the file is going, no names changes just different folders.
Thank you for quick response.
Upon further searching, I found the following code that does exactly what I needed to complete.
Thank you for all your help and responses.
Sub Move_File()
'Path/filename format ="C:\Folder\Folder\Filename.xls"
OldName = Sheet1.range("A1").Value
NewName = Sheet1.range("B1").Value
Name OldName As NewName
End Sub
Why did you ignore the suggestion in #3 ?
redundant variables in you code.
Sub Move_File()
Name Sheet1.range("A1").Value As Sheet1.range("B1").Value
End Sub
snb,
I didn't understand your code until I came across this other code that was more apparent to me but I failed to go back and review the responses before.
Your code does work well and it is simpler, sorry for not understanding it when you posted it but thank you for helping me understand it.
mancubus
10-14-2016, 11:58 PM
consider marking the thread as solved from threadtools. :)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.