Solved

VB Script modificatin needed

Posted on 2012-12-20
6
368 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

770 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