+ Reply to Thread
Results 1 to 3 of 3

Copy File without opening

  1. #1
    achidsey
    Guest

    Copy File without opening

    Excel Experts,

    Without opening the file, I want to copy a text file in one directory to
    another directory and save it with a different name.

    Specifically, I have a file C:\ACDocs\First\pa.txt"
    and without opening, I want to save it as C:\ACDocs\Second\portfolio.txt"

    I tried the below code but I an "Object Required" errror on the SaveCopyAs
    line.

    Sub Macro1()

    FN1 = "C:\ACDocs\First\pa.txt"

    FN1.SaveCopyAs "C:\ACDocs\Second\portfolio.txt"

    End Sub

    What code would work?

    Thanks in advance,
    Alan


    --
    achidsey

  2. #2
    Tom Ogilvy
    Guest

    Re: Copy File without opening

    Sub Macro1()

    FN1 = "C:\ACDocs\First\pa.txt"

    FileCopy FN1, "C:\ACDocs\Second\portfolio.txt"

    End Sub

    --
    Regards,
    Tom Ogilvy


    "achidsey" <[email protected](notmorespam)> wrote in message
    news:[email protected]...
    > Excel Experts,
    >
    > Without opening the file, I want to copy a text file in one directory to
    > another directory and save it with a different name.
    >
    > Specifically, I have a file C:\ACDocs\First\pa.txt"
    > and without opening, I want to save it as C:\ACDocs\Second\portfolio.txt"
    >
    > I tried the below code but I an "Object Required" errror on the SaveCopyAs
    > line.
    >
    > Sub Macro1()
    >
    > FN1 = "C:\ACDocs\First\pa.txt"
    >
    > FN1.SaveCopyAs "C:\ACDocs\Second\portfolio.txt"
    >
    > End Sub
    >
    > What code would work?
    >
    > Thanks in advance,
    > Alan
    >
    >
    > --
    > achidsey




  3. #3
    achidsey
    Guest

    Re: Copy File without opening

    Tom,

    Thanks as always.

    Alan

    --
    achidsey


    "Tom Ogilvy" wrote:

    > Sub Macro1()
    >
    > FN1 = "C:\ACDocs\First\pa.txt"
    >
    > FileCopy FN1, "C:\ACDocs\Second\portfolio.txt"
    >
    > End Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "achidsey" <[email protected](notmorespam)> wrote in message
    > news:[email protected]...
    > > Excel Experts,
    > >
    > > Without opening the file, I want to copy a text file in one directory to
    > > another directory and save it with a different name.
    > >
    > > Specifically, I have a file C:\ACDocs\First\pa.txt"
    > > and without opening, I want to save it as C:\ACDocs\Second\portfolio.txt"
    > >
    > > I tried the below code but I an "Object Required" errror on the SaveCopyAs
    > > line.
    > >
    > > Sub Macro1()
    > >
    > > FN1 = "C:\ACDocs\First\pa.txt"
    > >
    > > FN1.SaveCopyAs "C:\ACDocs\Second\portfolio.txt"
    > >
    > > End Sub
    > >
    > > What code would work?
    > >
    > > Thanks in advance,
    > > Alan
    > >
    > >
    > > --
    > > achidsey

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1