Results 1 to 4 of 4

Macro to strip out items in text file and paste into columns

Threaded View

  1. #1
    Registered User
    Join Date
    07-21-2012
    Location
    London, englan
    MS-Off Ver
    Excel 2007
    Posts
    7

    Macro to strip out items in text file and paste into columns

    Hello everyone;

    I am looking for a simple macro to extract information from a text file.

    I am creating the text file using the following command in command prompt: dir /S *.asf > VideoIndex.txt. This bypasses having to search hundreds of folders and manually extract the files names as it was being done previously.


    Within this text file is the following:
    ------------------------------------------------------------------------------------------------

    Volume in drive I is Seagate Backup Plus Drive
    Volume Serial Number is 061B-9493

    Directory of I:\VisualWorks\Projects\PROJECT\NE-LCP_SINS_2014_LC-SB-034_0001\DATA_20140901191709109

    09/01/2014 05:18 PM 470,254,325 20140901191709109@DVR2_Ch1.asf
    09/01/2014 05:18 PM 470,462,325 20140901191709500@DVR2_Ch2.asf
    09/01/2014 05:18 PM 470,422,331 20140901191709656@DVR2_Ch3.asf
    3 File(s) 1,411,138,981 bytes

    Directory of I:\VisualWorks\Projects\PROJECT\NE-LCP_SINS_2014_LC-SB-034_0001\DATA_20140901194709813

    09/01/2014 05:48 PM 470,390,325 20140901194709813@DVR2_Ch1.asf
    09/01/2014 05:48 PM 470,478,331 20140901194710047@DVR2_Ch2.asf
    09/01/2014 05:48 PM 470,414,331 20140901194710203@DVR2_Ch3.asf
    3 File(s) 1,411,282,987 bytes

    Total Files Listed:
    445 File(s) 165,834,604,455 bytes
    0 Dir(s) 1,850,604,470,272 bytes free

    ------------------------------------------------------------------------------------------------

    I need to extract the the Video File Name, Project Task ID, Date, From Time, To Time and put that into a Excel sheet as shown below.

    Video File Name			Project				Date	        From Time	To Time
    20140901191709109@DVR2_Ch1.asf	NE-LCP_SINS_2014_LC-SB-034_0001	1/9/2014		16:47:09		17:17:09
    20140901191709500@DVR2_Ch2.asf	NE-LCP_SINS_2014_LC-SB-034_0001	1/9/2014		16:47:09		17:17:09
    The Video File name is all the .asf extensions
    The Project Task ID is contained in the Directory name
    The Date is taken from the .asf file name ex. 20140901191709109@DVR2_Ch1.asf, gives me a date of > 20140901

    The Times are a bit weird and are extracted from the .asf file name. In this particular case we are taking the UTC time in the file name and subtracting -2.5 hours to get the "From Time", then taking the file name and subtracting -2.0 hours to obtain the "To Time". Each video file should be 30 minutes.
    ex. 20140901191709109@DVR2_Ch1.asf, gives a From Time of 16:47:09 and a To time of 17:17:09.


    I have a spreadsheet that does this but it uses a complex array of filtering, cell referencing and other formula to derive what I want. It works for me but I am the only one who knows how to use it I would like to make others peoples lives easier if I can and automate this better.

    Any help is greatly appreciated.
    Attached Files Attached Files
    Last edited by reesjordan; 09-10-2014 at 08:20 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. macro to copy used range and paste in the body tag of a html file/text file
    By amethystfeb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2014, 08:34 PM
  2. [SOLVED] Modify macro to repeat once, accept a different file type and paste into different columns
    By vegetable in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-07-2013, 12:46 PM
  3. Replies: 13
    Last Post: 11-29-2012, 08:25 PM
  4. Strip Excess Semi-Colon from Text File
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-29-2011, 01:30 PM
  5. [SOLVED] Strip out text copy and paste?
    By Mark Y via OfficeKB.com in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-07-2005, 09:20 AM

Tags for this Thread

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