View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Charlie Charlie is offline
external usenet poster
 
Posts: 703
Default FileSystemObject.copyfile

Sorry, it's not a space after the ".xls" it's a comma

FSO.CopyFile _
RnRPath & WorkingFiles & RnRTemplate, _
RnRPath & ".xls", DestFileName

"Charlie" wrote:

Maybe try:

Dim FSO as FileSystemObject
'then do:
FSO.CopyFile

'AND you need a destination filename

FSO.CopyFile _
RnRPath & WorkingFiles & RnRTemplate, _
RnRPath & ".xls " & DestFileName '(note the trailing space after .xls)

'(But I don't know about that LanID part, I removed it)


" wrote:

It looks OK, so it MIGHT be worth storing the strings in variables and
using those rather than getting the CopyFile to concatenate.

KR wrote:
I'm using the following:

FileSystemObject.CopyFile _
RnRPath & WorkingFiles & RnRTemplate, _
RnRPath & LanID & ".xls"

and getting a runtime 424 object required error.

RnRPath is a network path, e.g. "\\server\folder\"
WorkingFiles is just a subfolder, e.g. "subfolder\"
RnRTemplate is a filename, e.g. "MyFile.xls"
And LanID is the user's login ID string, e.g. "myname"

I've checked the string assignments for the above variables, and they point
to a file and directory that exists.... Is there something else I should be
checking, or is it likely to be something about the paths and filename that
I'm not seeing? I have network access to all of these areas and use these
files 'manually', just can't seem to get it working in code.

Thanks!
Keith