+ Reply to Thread
Results 1 to 7 of 7

code to copy txt files from floppies

  1. #1
    Registered User
    Join Date
    08-24-2007
    Posts
    18

    code to copy txt files from floppies

    Hi all,

    i m attaching excel sheet where i have to paste the data from txt files that come to me on floppies (18 floppies from 18 departments)

    the floppies have data in rows. i have to omit first and last row of that txt file and copy all the rest rows in column H of my sheet Named "DATA". you may understand that this data has to be pasted one below the other in subsequent rows.
    i then use MID formula to get the information from this data into column A to column F

    MY PROB IS
    that i want a button on my sheet DATA that i click to get data from inserted floppy in drive A.
    code must check the file name
    which is named in a convention as under

    Example:
    ICI short name of deptt
    1 or 2 zone number which is always 1 or 2 and i have 2 DATA sheets i.e. DATA for zone 1 and DATA2 for zone 2
    then comes the four digits for date and month
    1211 where 12 is date and 11 is NOV month

    help a code that reads the file with current (today's) date only and ignores all other files if any on the floppy. it should also ignore zone 2 if i m on DATA and it shud ignore zone 1 if i m on DATA2.
    here i need two separate codes for my two sheets namely DATA and DATA2. DATA gets files for Zone 1 and in the second session the DATA2 gets files for Zone 2.

    i know my prob is some tough but you guys are great at codes and i hope to get the solution.

    thnx in advance
    Attached Files Attached Files
    Last edited by hsmeet; 11-16-2008 at 08:34 PM. Reason: to elaborate more

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    See how this goes. Assumes that the files will be on the root directory of the floppy. Didn't test it on a floppy.....

    Please Login or Register  to view this content.
    HTH

    rylo

  3. #3
    Registered User
    Join Date
    08-24-2007
    Posts
    18

    it did not help

    sorry sir,
    i tried your code by copying it into new sub and then assigning the macro to a button.
    when i click the button the system assesses the floppy but nothing else happens.

    i m quite new to VBE and could not find the problem in code


    please help

  4. #4
    Registered User
    Join Date
    08-24-2007
    Posts
    18
    Hi All,
    My problm remains unsolved

    i hope i could not make you ppl understand my prob properly.

    anyways,
    i m doing this manually...
    thanx u all

    TC

  5. #5
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    1) Are the files on the root directory on the A drive? If not then where are they (what is the full path to one of the files.)

    2) Try copying one of the files to C:\temp. Change the line
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    and see if that works.

    3) If that doesn't work, then put up a copy of one of the text files, and the output file so we can review.


    rylo

  6. #6
    Registered User
    Join Date
    08-24-2007
    Posts
    18
    Dear Rylo,

    it still does not work for me.
    the source and output files are already posted by me in my first post above.

    the txt.zip is having all the files that i have to copy to my output file "New One.xls" in its DATA sheet. rest is already mentioned in my first post.

    please help

    (sorry for late responding as i was away for some days)

  7. #7
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Don't know what else to suggest. I put the file ICI11211.txt into C:\TEMP, then renamed it to ICI12811.txt. Put the code I gave you into module 1 of new one.xls, changed the drive and directory to reflect C:\temp and ran the code. Brought in the file OK.

    rylo

+ 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