Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default FSO copy file returns permission denied

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default FSO copy file returns permission denied

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default FSO copy file returns permission denied

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default FSO copy file returns permission denied

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default FSO copy file returns permission denied

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default FSO copy file returns permission denied

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
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
Permission Denied Varne Excel Programming 2 January 22nd 10 11:12 PM
Permission denied when copying file IanC[_2_] Excel Programming 1 June 25th 08 10:22 PM
permission denied SandyR Excel Programming 2 November 16th 05 01:53 PM
file delete in Excel receives permission denied by Server 2003 phurst Excel Programming 2 March 10th 05 09:43 PM
Permission Denied Audrey Ng Excel Programming 1 October 1st 03 07:20 AM


All times are GMT +1. The time now is 09:35 PM.

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

About Us

"It's about Microsoft Excel"