Solved

VB Script modificatin needed

Posted on 2012-12-20
6
364 Views
Last Modified: 2012-12-20
Hi,

Had a script done by RSampson last week that stripped a file and created a new file whenever it found |2102| in the Years column.  Problem is it runs on all files in a directory but the Years column is not always in the same column.  Additionally a data value could be 2012 also as I found out.  Thus I need some tweaks.  You will see below that the 2nd row of data contains |2012| however that's Units and not Years.  Thus current script grabbed that row which is a problem I didn't forsee.  So is there a way I can define which column to search for 2012 for each file?  So somewhere in the script I can list out the filenames and which column to look for 2012 in?  

Style 01 7 75 756 03 01 899833|Fiscal Rcpt Feb|MdseTyp F|2012|1938|6143.46|445.74|25174.6200000000|0.00|651193

Style 01 7 75 756 03 01 899833|Fiscal Rcpt Jan|MdseTyp F|2011|2012|6378.04|462.76|26135.8800000000|0.00|651194
splice.vbs
0
Comment
Question by:elwayisgod
  • 5
6 Comments
 

Author Comment

by:elwayisgod
ID: 38709975
Here's the list of filenames and the column I need to search for 2012 in.
filenames-and-years-column.xlsx
0
 

Author Comment

by:elwayisgod
ID: 38710347
Sample files
Load.zip
0
 
LVL 2

Accepted Solution

by:
tempor2001 earned 500 total points
ID: 38710541
try this script please. it uses additional file with filenames and columns definition (csv version of filenames-and-years-column.xlsx)
also I put found and not found result files in separate folder to prevent results scanning on second run.
splice.vbs
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:elwayisgod
ID: 38710715
I get an error:


D:\AppFiles\SDS\SDS_Retail_R3\Data\Working\DataFiles\Spliced\VB>cscript splice.v
bs > splice.log
D:\AppFiles\SDS\SDS_Retail_R3\Data\Working\DataFiles\Spliced\VB\splice.vbs(1, 15
) Microsoft VBScript compilation error: Expected end of statement


D:\AppFiles\SDS\SDS_Retail_R3\Data\Working\DataFiles\Spliced\VB>
0
 

Author Comment

by:elwayisgod
ID: 38710728
Never mind.. hold on a sec
0
 

Author Closing Comment

by:elwayisgod
ID: 38710772
Perfect.  Both the DOS and VB results are identical.  Thanks much!!!!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now