Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following code produces a permission denied error when trying to copy a
file. Private Sub ReplaceDep(sCurPath, sTPPath) Dim oFileSysObj As Object Set oFileSysObj = CreateObject("Scripting.FileSystemObject") ' Following line gives "Permission denied (Error 70)" oFileSysObj.CopyFile sCurPath & "\Deploy2.bat", sTPPath End Sub sCurPath and sTPPath are both valid paths and neither have any write restrictions. The file to be copied exists, is not protected in any way and is not open. I've tried replacing the variable with hard coded paths. Out of desparation, I've tried adding ", True" at the end of the line to force overwriting, even though the filename does not exist in the destination folder and True is default for the argument anyway. I've never used CopyFile before so I may be missing something really obvious (though not to me). Using other code I am able to save an open XL file to the same folder (sTPPath), so there's no problem writing to the folder with VBA. Any ideas? -- Ian -- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
permission denied | Excel Programming | |||
error 70 - Permission denied | Excel Programming | |||
file delete in Excel receives permission denied by Server 2003 | Excel Programming | |||
Permission to use object denied | Excel Programming | |||
Permission Denied | Excel Programming |