Re: error when using FileCopy

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jim Edgar (djedgarNOSPAM_at_cox.net)
Date: 12/17/04


Date: Fri, 17 Dec 2004 14:54:02 -0800


"Mike" <Mike@discussions.microsoft.com> wrote in message
news:1C8A0885-0075-4334-88A2-623089DA96DE@microsoft.com...
> Hello, I'm using VB6, and I'm making an app that reads in a file, writes to
> an output file, and then is supposed to replace the input file with the new
> output file. So I tried using Rename to do that, but my compiler acted like
> Rename didn't exist as a function, and so I tried FileCopy. It recognized it
> as a fuction, but kept giving me an error saying a '=' was expected. The
> line of code that produced the error was:
>
> FileCopy(outName, inName)
>
> Am I missing something?
> --
> Thank you,
> Mike

Try using FileCopy without the paranthesis:

FileCopy outName, inName

Also, you can rename files just use Name:

Name strFile As strRenamedFile

Jim Edgar



Relevant Pages

  • Re: GP project setup utility?
    ... I probably should just look at the help files in msdn, ... is there a copyfile function, or do I have to make my own? ... Can I do the rename as part of the same operation? ... If you decide to program in VB6 use FileCopy. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Does anyone know how to write VB?
    ... the VB program must rename the output file. ... But, rather than force VB to wait in a tight loop, I would suggest using a timer. ... Private Sub Timer1_Timer ...
    (microsoft.public.vb.general.discussion)
  • Help Ccg File
    ... I'm trying to write the code to rename a file (eventually a lot of ... do with the File.System.Object that should come before the FileCopy ... Dim DestinationFile As String ...
    (microsoft.public.scripting.vbscript)
  • Re: variable argument in rename()
    ... The original program produces an output file called ... The code reads an input file containing a timestamp and I ... > working - I can only get rename to work if I use something like ... My first advice ...
    (comp.lang.fortran)
  • Re: script encoder problem
    ... to rename to .vbe automatically. ... > Why would you do that if you wanted the output file to have a .vbe ... >> or just specify the directory to put the output file in it ...
    (microsoft.public.scripting.wsh)