?
Solved

VB Script modificatin needed

Posted on 2012-12-20
6
Medium Priority
?
375 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 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