Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Move and rename a file | Excel Programming | |||
Move a file | Excel Programming | |||
Move File | Excel Discussion (Misc queries) | |||
Move rows from 1 file to other file? | Excel Programming | |||
Move File When The ... | Excel Programming |