To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Office Development

Closed Thread Post New Thread
 
Thread Tools Display Modes
Old Apr 10th, 2003, 06:04 AM   #1
ITboy
Lively Member
 
Join Date: Mar 03
Location: singapore
Posts: 86
ITboy is an unknown quantity at this point (<10)
Check txt file 4 mealbreak n display in XL??

Im reading in a text file in Excel...There are data like this:
TT101,B01,MB1,0,1,rmk
TT101,C02,C12,5,6,
etc
etc
etc
in it..
The first param is an ID then,from blk, to blk, start time, end time, remarks..remarks is blank sometimes.. When reading the file, if it encounters "MB1" then my program should check which blk and in which period it falls.. (The first param is an ID then,from blk, to blk, start period, end period, remarks). Getting this info, it should go to the sheet(attchaced is the file) and check the periods against the blk (take a good look at it pls). If lets say it gets the data as above (TT101,B01,MB1,0,1,rmk) then it should highlight and print the word MB1 or MB2(I've shown it in the file at cell O3, pls download n see) Thanks alot for help guys..Pls help..
Attached Files
File Type: zip mbreak.zip (5.2 KB, 9 views)
ITboy is offline  
Old Apr 10th, 2003, 11:18 AM   #2
opus
I don't do your homework!
 
opus's Avatar
 
Join Date: Jun 00
Location: Good Old Europe
Posts: 2,783
opus has a spectacular aura about (150+)opus has a spectacular aura about (150+)
Hi ITBoy,
you are obviously working on a bigger application, asking this forum to help you out on some problems.
Reading your threads makes me wonder a bit.
Do you only copy and paste the code given in here into your application? Or why do you encounter problems because, some information is hendled in different UserForms. It just sounds fishy to me!
I do hope you have a plan for your complete application, if not you'll be lost within the next couple of weeks in all that muddle of code-pieces you patch together!!!!


But now to your recent question:

WHAT do you want??
I guess you know by now how to read from your textfile.
You should also know how to fill specific cells in your EXCEL-file.
More specific , you should be able to mark specific cells in your EXCEL-file that match a given Period and "BLk" (Using the code I gave you).
So the only thing you should need is the logic that gives you the Period and the Blk for each Line of the textfile; isn't it!

To help you in this, please ******** the "from Blk" and "to Blk" . In your example the "from Blk" is B01, that'S understood, but what is the "to Blk" (the Value is MB1, a value that hasn't been in the Blk-Values so far).
Is it correct that the Endtime makes the Period?
The second example would be Period 6 for blk C02 but in here the second Blk is C12, which is a "normal" one ?????????
__________________
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button


Wait, I'm too old to hurry!
opus is offline  
Old Apr 10th, 2003, 12:07 PM   #3
ITboy
Lively Member
 
Join Date: Mar 03
Location: singapore
Posts: 86
ITboy is an unknown quantity at this point (<10)
Yes Opus..I do agree that i do copy paste codes from here to a certain extent but most of the time i do it by myself or make modifications to codes given here. As you've asked "C12" goes with period 6 and C02 with 5 (thinnk u forgot is it).. is the correct data(only blks) but now i heard that some data from the engine may come with MB1 or MB2 in either of the 2 columns so in such situation have to highlight a cell in Sheet1 as shown in attached file..Thanks Opus..

Last edited by ITboy; Apr 10th, 2003 at 12:11 PM.
ITboy is offline  
Old Apr 10th, 2003, 01:49 PM   #4
opus
I don't do your homework!
 
opus's Avatar
 
Join Date: Jun 00
Location: Good Old Europe
Posts: 2,783
opus has a spectacular aura about (150+)opus has a spectacular aura about (150+)
OK, so you only need to know if one of the "from Blk" and "to Blk" Values is MB1.
Assuming you read each line of the textfile into a StringVar. do that for each line:

VB Code:
  1. Values = Split(StringVar, ",")
  2. 'Now you have the line from the textfile split into the array Values
  3. If Values(1)="MB1" then
  4.    'put the code to write this value into the sheet in here
  5.    'the period is Val(Values(3)
  6. End if
  7. If Values(2)="MB1" then
  8.    'put the code to write this value into the sheet in here
  9.    'the period is Val(Values(4)
  10. End if
__________________
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button


Wait, I'm too old to hurry!
opus is offline  
Old Apr 11th, 2003, 01:29 AM   #5
ITboy
Lively Member
 
Join Date: Mar 03
Location: singapore
Posts: 86
ITboy is an unknown quantity at this point (<10)
I dont understand value3 and value 4..Can u pls show me a sample code..?thanks.
ITboy is offline  
Old Apr 11th, 2003, 02:10 AM   #6
opus
I don't do your homework!
 
opus's Avatar
 
Join Date: Jun 00
Location: Good Old Europe
Posts: 2,783
opus has a spectacular aura about (150+)opus has a spectacular aura about (150+)
Your textfile looks like:
TT101,B01,MB1,0,1,rmk

You read that into StringVar

after the Command
VB Code:
  1. Values = Split(StringVar, ",")
you have:
Values(0)="TT101"
Values(1)="B01"
Values(2)="MB1"
Values(3)="0"
Values(4)="1"
Values(5)="rmk"

So the Periods are in Values(3) and Values(4), since they are Strins you need the Use Val(Values(3)) to make them to Numbers!
__________________
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button


Wait, I'm too old to hurry!
opus is offline  
Old Apr 11th, 2003, 03:52 AM   #7
ITboy
Lively Member
 
Join Date: Mar 03
Location: singapore
Posts: 86
ITboy is an unknown quantity at this point (<10)
It highlights the function "Split" saying Sub or Function Not defined..
ITboy is offline  
Old Apr 11th, 2003, 04:10 AM   #8
opus
I don't do your homework!
 
opus's Avatar
 
Join Date: Jun 00
Location: Good Old Europe
Posts: 2,783
opus has a spectacular aura about (150+)opus has a spectacular aura about (150+)
I pasted the code from EXCEL-VBA after testing it!!
Split is a build-in from VBA!!!!!!
You do have StringVar and Values() declared, don't you!
__________________
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button


Wait, I'm too old to hurry!
opus is offline  
Closed Thread

Go Back   VBForums > Visual Basic > Office Development


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:19 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.