VBA permission errors

L

Lumpjaw

Helllo All,

I have the following code to copy a file to a newly created folder.

JobDirectory = 'c:\Job Files\"
JobNumber= 'B 06-100"
JobName='Construction"

Why am I getting a permission error, this all happens on my laptop, no
network.



Const OverwriteExisting = True

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\Job Setup\Project Information.doc", JobDirectory &
JobNumber & "." & JobName, OverwriteExisting



Thanks for the replies.
 
J

Jonathan West

Lumpjaw said:
Helllo All,

I have the following code to copy a file to a newly created folder.

JobDirectory = 'c:\Job Files\"
JobNumber= 'B 06-100"
JobName='Construction"

is this actually pasted from your VBA editor?

Why am I getting a permission error, this all happens on my laptop, no
network.



Const OverwriteExisting = True

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\Job Setup\Project Information.doc", JobDirectory &
JobNumber & "." & JobName, OverwriteExisting

What exactly the the location you want to copy to? The destination you have
given is "c:\Job Files\B 06-100.Construction"

is that right? Is "B 06-100.Construction" supposed to be a filename or a
older name? Do you want a .doc extension? does "C:\Job Files\" exist?


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top