Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to copy a file by fso by i am getting error 70 (permission denied).
I have admin rights on the pc. Here is the code. Sub COPY_INVOICES() Dim inv As String Dim fso Set fso = CreateObject("Scripting.FileSystemObject") FILETO = InputBox("PL ENTER FULL PATH WHERE YOU WANT TO COPY FILES", "PATH") FILEFROM = "C:\INVPDF\" & Range(A1").value & ".pdf" fso.CopyFile FILEFROM, FILETO End Sub I am entering full path in inputbox. Pl help to resolve. Regards, Madiya |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Possibly you don't have either the permissions required to read the original file, or the permissions required to write to the new location.
Tim On Monday, April 2, 2012 5:41:25 AM UTC-7, Madiya wrote: I am trying to copy a file by fso by i am getting error 70 (permission denied). I have admin rights on the pc. Here is the code. Sub COPY_INVOICES() Dim inv As String Dim fso Set fso = CreateObject("Scripting.FileSystemObject") FILETO = InputBox("PL ENTER FULL PATH WHERE YOU WANT TO COPY FILES", "PATH") FILEFROM = "C:\INVPDF\" & Range(A1").value & ".pdf" fso.CopyFile FILEFROM, FILETO End Sub I am entering full path in inputbox. Pl help to resolve. Regards, Madiya |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tim,
Thanks for reply. I have admin rights on this PC. I am able to copy, paste & delete in both the folders. If I save any excel file in both folders, no problem. This error comes up only while I use FSO in VBA. Any thoughts? Regards, Madiya On Tuesday, 3 April 2012 01:17:22 UTC+5:30, Tim Williams wrote: Possibly you don't have either the permissions required to read the original file, or the permissions required to write to the new location. Tim On Monday, April 2, 2012 5:41:25 AM UTC-7, Madiya wrote: I am trying to copy a file by fso by i am getting error 70 (permission denied). I have admin rights on the pc. Here is the code. Sub COPY_INVOICES() Dim inv As String Dim fso Set fso = CreateObject("Scripting.FileSystemObject") FILETO = InputBox("PL ENTER FULL PATH WHERE YOU WANT TO COPY FILES", "PATH") FILEFROM = "C:\INVPDF\" & Range(A1").value & ".pdf" fso.CopyFile FILEFROM, FILETO End Sub I am entering full path in inputbox. Pl help to resolve. Regards, Madiya |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear all,
Pl help. Regards, Madiya On Wednesday, April 4, 2012 5:00:26 PM UTC+5:30, Madiya wrote: Tim, Thanks for reply. I have admin rights on this PC. I am able to copy, paste & delete in both the folders. If I save any excel file in both folders, no problem. This error comes up only while I use FSO in VBA. Any thoughts? Regards, Madiya On Tuesday, 3 April 2012 01:17:22 UTC+5:30, Tim Williams wrote: Possibly you don't have either the permissions required to read the original file, or the permissions required to write to the new location. Tim On Monday, April 2, 2012 5:41:25 AM UTC-7, Madiya wrote: I am trying to copy a file by fso by i am getting error 70 (permission denied). I have admin rights on the pc. Here is the code. Sub COPY_INVOICES() Dim inv As String Dim fso Set fso = CreateObject("Scripting.FileSystemObject") FILETO = InputBox("PL ENTER FULL PATH WHERE YOU WANT TO COPY FILES", "PATH") FILEFROM = "C:\INVPDF\" & Range(A1").value & ".pdf" fso.CopyFile FILEFROM, FILETO End Sub I am entering full path in inputbox. Pl help to resolve. Regards, Madiya |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi,
did you add the reference to "Microsoft Scripting Runtime" (Tools / VBA references) -- isabelle Le 2012-04-11 10:37, Madiya a écrit : Dear all, Pl help. Regards, Madiya |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
From the FileSystemObject help file...
object.CopyFile ( source, destination[, overwrite] ) CopyFile will fail if destination has the read-only attribute set. Wildcard characters can only be used in the last path component of the source argument. For example, you can use: FileSystemObject.CopyFile "c:\mydocuments\letters\*.doc", "c:\tempfolder\" But you cannot use: FileSystemObject.CopyFile "c:\mydocuments\*\R1???97.xls", "c:\tempfolder" If source contains wildcard characters or destination ends with a path separator (\), it is assumed that destination is an existing folder in which to copy matching files. Otherwise, destination is assumed to be the name of a file to create. In either case, three things can happen when an individual file is copied. ? If destination does not exist, source gets copied. This is the usual case. ? If destination is an existing file, an error occurs if overwrite is false. Otherwise, an attempt is made to copy source over the existing file. ? If destination is a directory, an error occurs. An error also occurs if a source using wildcard characters doesn't match any files. The CopyFile method stops on the first error it encounters. No attempt is made to roll back or undo any changes made before an error occurs. -- Jim Cone Portland, Oregon USA http://www.mediafire.com/PrimitiveSoftware (List Files XL add-in: finds and lists files/folders with hyperlinks) "Madiya" wrote in message Dear all, Pl help. Regards, Madiya |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Permission Denied | Excel Programming | |||
Permission denied when copying file | Excel Programming | |||
permission denied | Excel Programming | |||
file delete in Excel receives permission denied by Server 2003 | Excel Programming | |||
Permission Denied | Excel Programming |