+ Reply to Thread
Results 1 to 4 of 4

change the file format of a text file.

  1. #1
    GeneWan
    Guest

    change the file format of a text file.

    I need to abstract data from a text file, but if the file extension is
    ".log", I need to change it to ".txt".

    I can only think of doing this by first opening "ABC.log" (in the
    background), upon detection of a .log extension, will use "Save As.. ABC.txt

    this was what I did manually at first, but I need to speed up as there are
    going to be tens of files with .log extension to be converted..

    can anyone help?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello GeneWan,

    You can do this more easily by using the Name statement. Once your file is closed use the following in your VBA code...

    Name filename.log As filename.txt

    Sincerely,
    Leith Ross

  3. #3
    GeneWan
    Guest

    Re: change the file format of a text file.

    Hi Leith,

    Would this create a new copy or does it overwrite the original file? My
    intention is to save it as a new file with the similar filename.


    "Leith Ross" wrote:

    >
    > Hello GeneWan,
    >
    > You can do this more easily by using the Name statement. Once your file
    > is closed use the following in your VBA code...
    >
    > Name filename.log As filename.txt
    >
    > Sincerely,
    > Leith Ross
    >
    >
    > --
    > Leith Ross
    > ------------------------------------------------------------------------
    > Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
    > View this thread: http://www.excelforum.com/showthread...hreadid=545734
    >
    >


  4. #4
    NickHK
    Guest

    Re: change the file format of a text file.

    Gene,
    FileCopy "c:\Source.txt", "c:\Source2.txt"

    NickHK

    "GeneWan" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Leith,
    >
    > Would this create a new copy or does it overwrite the original file? My
    > intention is to save it as a new file with the similar filename.
    >
    >
    > "Leith Ross" wrote:
    >
    > >
    > > Hello GeneWan,
    > >
    > > You can do this more easily by using the Name statement. Once your file
    > > is closed use the following in your VBA code...
    > >
    > > Name filename.log As filename.txt
    > >
    > > Sincerely,
    > > Leith Ross
    > >
    > >
    > > --
    > > Leith Ross
    > > ------------------------------------------------------------------------
    > > Leith Ross's Profile:

    http://www.excelforum.com/member.php...o&userid=18465
    > > View this thread:

    http://www.excelforum.com/showthread...hreadid=545734
    > >
    > >




+ 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