Move a file
Thanks Dana. Otto
"Dana DeLouis" wrote in message ... I want to move (not copy) a file from one folder to another folder. ... and I got a #70 error "Permission denied" As a side note, you will also get #70 error "Permission denied" if you give a destination without a trailing "\" character to indicate it's a folder. Sub Demo() Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") FSO.MoveFile "C:\Junk A\Dummy.txt", "C:\Junk B\" End Sub -- HTH :) Dana DeLouis "Otto Moehrbach" wrote in message ... Duh! The Test.xls file was open and that created the "Permission Denied" error. I closed the file and the code copied the file. I then changed the FileCopy line to: Name PathSource & FileName As PathDest & FileName and all was well. Thanks anyway. Otto "Otto Moehrbach" wrote in message ... Excel XP & Win XP I want to move (not copy) a file from one folder to another folder. I tried the following test macro and I got a #70 error "Permission denied" on the "FileCopy" line of code. What is the proper code to move a file? Thanks for your time. Otto PS: My computer is a sole home computer, not hooked up to any network at all. Sub TestMove() Dim PathSource As String Dim PathDest As String Dim FileName As String PathSource = "C:\ASource\" PathDest = "C:\ADest\" FileName = "Test.xls" FileCopy PathSource & FileName, PathDest & FileName End Sub |
All times are GMT +1. The time now is 10:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com