#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Move and rename a file Peter[_61_] Excel Programming 2 January 26th 07 01:23 PM
Move a file Damien Excel Programming 2 August 8th 06 07:53 AM
Move File THE_RAMONES Excel Discussion (Misc queries) 3 May 25th 06 09:31 PM
Move rows from 1 file to other file? shital shah Excel Programming 0 April 24th 06 12:09 PM
Move File When The ... sal21[_9_] Excel Programming 1 February 18th 04 10:10 PM


All times are GMT +1. The time now is 11:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"