No New Line
Code: Open "log.txt" For Append As #1 Print #1, key Close #1 How can I avoid it writing to a new line in log.txt?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
- Line Input #1, Line...how Do I Read Ahead One Line (or Back Up One Line)
- Line By Line Text File Read And Correct Each Line
- Replacing A Line Of Text With A Blank Line, Then Delete That Line
- Needing Experienced Programmer For Help - Parsing && Changing Line By Line In Txt File
- Prevent Multi Line Textbox From Wrapping Incomplete Words To The Following Line
- MsgBox Showing All Multi-line Footnotes That Have Carriage Return At End Of Line
- Leading Spaces Of Each Line Ina Multi-line DataReport Field Has Been Trimmed
- Read, Find A Line And Delete The Line In Text File
- Getting Current Line And Position On Line For Regular And RichText Boxes.
- How To Display Second Line If The First Line In Text File Is Meet The Condition
- .Input ( Read Contentsof Text File - Line By Line )
- Reading A Tab Delimited Text File Line By Line Into An Array
- Line Input #n,,<string> Stops When [null] Is In The Line
- Get Line Form Text File 1 Line At A Time
- Trouble Reading Line By Line From A Text File
- Capture Api Line Images And Image.line Question
- How Can I Read One Line By One Line From A Multiline Text Field ?
- Richtextbox : How To Change/set A Line Position To Move The Line Up/down?
- Ensuring Only 65 Chars Per Line In Multi Line Textbox
- Read File Line By Line, Populate Listbox
- Put Specified Line By Line Number Of A Text File Into String
- Reading File Line By Line With Comma's In Lines
- Read A Word In A Line Of Text And Delete That Line
- New Line (vbCrLf) Leaves Symbol? / New Line Alternatives?
- How To Read Rich Text Box Content Line By Line
- Reading A Text File Line By Line For Spellcheck
- Send Line By Line From A Richtextbox With Brake Between Each [Solved]
- Loading Lines From A Text File Line By Line
- Extract Line By Line Of String Freom RichTextBox ..
- Run Time Error When Read File Line By Line
- Faster To Read Line By Line, Or Whole File And Then Process?
- * RESOLVED * Reading A File Line By Line Problem.
- Reading TextFiles Line By Line (Need To Know How To With Opening A File)
- Rich Textbox - Making A Given Line The Top Line Displayed
- Searching For A String In A Text File Line By Line
- Reading A Text File Line By Line ***RESOLVED***
- How Can I Read Only One Line Or Specific Line Of A Text File
- How To Force New Line Of Text In A Multi Line Textbox
- Check Every Line In Multi Line Textbox [resolved (already)]
- File Copy Line By Line...Needs Delimiter Capability
- Deleting A Line Based On What Ends The Line
- Newbie Question: Read Line By Line?
- Compare One Line To Next Line, Same File, And Do Things With It
- Error Reading File Line By Line
- Reading A Text File Line By Line
- Line Input Question && Line Parse ?
- Parse MailItem.body Line By Line
- Looping Through A File In Word, Line By Line
- Append Line To String With Line Input
- Strip Down Textbox To A Line Then To Part Of The Line
Line Input #1, Line...how Do I Read Ahead One Line (or Back Up One Line)
I am loading a file line by line using the LIne Input but at one point i need to look ahead at the next line to decided what to do on the current line...how do i look ahead one line? or how do i use the line Input function and then back up? Any help would be greatly appreciated.
Shane Thomas
p.s. please email replys in addition to the reply of post too
shathoma@nmsu.edu
Line By Line Text File Read And Correct Each Line
Can anyone help me create a small program or have any pointers
on pieces of code that reads a text file from folder "unfixed" then
fix the contents and then store the corrected contents
in another folder "fixed" and then move the file in folder "unfixed" to folder "old"
Details of contents.
There is a space infront of each line that should be removed.
Between the first group of numbers and the second there should be a zero for every space.
Then after the second group of numbers there should be just one space and the rest trimed off.
011531015222360000500355 3350505212004 50122
011531015222360000500363 5336305212004 6255
011531015222360000503465 2404505212004 50022
011531015222360000503463 1345205212004 50025
02153101522236 13 1503256
The @ symbol represents where a space should be.
I would like to read the file and then correct it and then
place the fixed contents in another folder with the original name.
Below is how I would like it to look.
01153101522236000050035500000003350505212004@
01153101522236000050036300000005336305212004@
01153101522236000050346500000002404505212004@
01153101522236000050346300000001345205212004@
021531015222360000000013@
Replacing A Line Of Text With A Blank Line, Then Delete That Line
The code below works perfect, retrieving the string of text that the user selects from the listview. Then I do bla bla bla. What I want to do is convert this so that the the user selects a string from the listview which corresponse to a string in the file. then click remove. my problem is, how do i remove a line of text from a text file? if i open for reading i cant modify the contents, if i open for writing it erases the data. and i dont want to write the data into a string, parse out the string that i don't want then rewrite the file.... that could be....not so good...
---------------------------------------------------------------------------------
'the line that actually is in the file..
email=gmatteson@myemail.com
i want to remove this line...
---------------------------------------------------------------------------------
Dim strSelected As String
strSelected = lvwAccounts.ListItems(lvwAccounts.SelectedItem.Index)
Dim objFSO As New FileSystemObject
Dim objFile As File
Dim objTS As TextStream
Dim strReadline As String
Dim strFind As String
Dim strData As String
Dim strEmail As String
Dim blnFound As Boolean
Set objFile = objFSO.GetFile(App.Path & "pop3a.txt")
Set objTS = objFile.OpenAsTextStream(ForReading)
Do Until objTS.AtEndOfStream Or blnFound = True
'reads line in file
strReadline = objTS.ReadLine
strFind = "="
strData = (InStr(1, strReadline, strFind) + 1)
strEmail = Mid(strReadline, strData)
If strEmail = lvwAccounts.SelectedItem.Text Then
frmEdit.txtEmail = strEmail
blnFound = True
End If
Loop
---------------------------------------------------------------------------------
Thanks,
- Gabe
Needing Experienced Programmer For Help - Parsing && Changing Line By Line In Txt File
Hello,
I'm a senior in HS and needing some help parsing a text file.
I have this in the text file:
ProjectList(0) = ""
ProjectList(1) = "A015"
ProjectList(2) = "A049"
ProjectList(3) = "A052"
ProjectList(4) = "C033"
ProjectList(5) = "C035"
ProjectList(6) = "C036"
ProjectList(7) = "C039"
ProjectList(8) = "E001"
ProjectList(9) = "E017"
ProjectList(10) = "E018"
ProjectList(11) = "E025"
ProjectList(12) = "G076"
ProjectList(13) = "G079"
ProjectList(14) = "H007"
ProjectList(15) = "H012"
ProjectList(16) = "K253"
ProjectList(17) = "M002"
ProjectList(18) = "M036"
ProjectList(19) = "M042"
ProjectList(20) = "M043
Problem:
The problem is that if i add another entry, for example, ProjectList(16) = "K254" it has to be in sequential order/alphabetical order. Well, I need to be able to add a line, and then from there renumber the rest of the projectlist items, from that item down.. Because if you add one, say at ProjectList(2), it messes up the order.. No big deal you say...but the rest of the file goes to 138 records and everytime you have to renumber it by hand...I'd like to automate this..
I have tried using Split function in VB, filter, Replace function, but I can't seem to break apart each line, increment the number, and then do that the same for the rest of the file, all while being able to have this functionality work no matter where or what number in the sequence it is.... If anybody could guide me, I would be indebted... Thanks!!
I have attached a text file of it if anybody needs to see what I'm talking about...
Prevent Multi Line Textbox From Wrapping Incomplete Words To The Following Line
Hi.
I've created a textbox that will mimic a mainframe screen that has a dimension of 80 X 24.
The following textbox properties are set as follows:
Multiline = True
Word wrap = True
When a user enters text into this textbox the text will wrap after every 80 characters, just like it would when typing on a mainframe screen.
PROBLEM: I would like the textbox to wrap only complete words to the next line...just like this forum textbox that I am typing into right now does..
would anyone know the code to accomplish this?
Thanks in advance..
marc
MsgBox Showing All Multi-line Footnotes That Have Carriage Return At End Of Line
Can I tell Word via VBA to show me all the footnotes that erroneously
have a carriage return at the end of multi-line footnotes. ?
To be more specific there are still people who press enter at the end
of a written line instead of let Word do the line break
automatically.
The MsgBox should say for example:
Footnote 1: carriage return, page 7
Footnote 2: carriage return, page 9
etc.
Could please somebody give me a hint ? Thank you very much in
advance.
Regards,
Andreas
Leading Spaces Of Each Line Ina Multi-line DataReport Field Has Been Trimmed
I have a multi-line textbox that update a SQL table field. However, when printing the field in a datareport, all leading spaces of each lines has been trimmed, just like all lines left-aligned. Is there any settings I need to set, or this is a bug of datareport? I got this problem in VB6 SP4 & SP5.
I've checked that the spaces have been saved in the SQL rec.
Moreover, I found that I put a multi-line textbox to a datareport label gets the same result.
Thx for your help.
Read, Find A Line And Delete The Line In Text File
Hi, I am writing codes to do the following things: read a line from a text file, if this is a matched line, delete the line and go to the next line.
Can any one give me some direction? Such as access mode, method to use, etc.
Thanks.
.Input ( Read Contentsof Text File - Line By Line )
I'm trying to import Data from a text file, which includes the following,
Vessel Name
000115600
000025600
000000000
000089000
000019000
000000000
6670.43
The above file is updated every five minutes and I wish to retreive this data in
order to perform calc's and then display a completion time for a process on the
User Form.
code:-----------------------------------------------------------------------------
---
Open "YourFile.txt" For Input As #1
While Not EOF(1)
Input #1, YourVariable
List1.Additem YourVariable
Wend
Close #1
--------------------------------------------------------------------------------
Instead of adding to a list as in the above example, I want to process it Line by
Line ( How do I achieve this using .Input ).
Help
Reading A Tab Delimited Text File Line By Line Into An Array
I have a tab delimited file created by an outside source.
I am using the below code to read it's contents into an array.
Function openFile()
Dim FileNum As Integer
Dim TotalFile As String
FileNum = FreeFile
' Reads the entire file into memory all at once
Open "c:DBUpdaterpgstd.txt" For Binary As #FileNum
TotalFile = Space(LOF(FileNum))
Get #FileNum, , TotalFile
Close #FileNum
TotalFile = Replace(TotalFile, vbNewLine, vbTab)
Fields = Split(TotalFile, vbTab)
'For X = 1 To UBound(Fields) Step 1
' Now the array can be used in the mdb comparing
'Debug.Print Fields(X)
'Next
End Function
My issue is that I am trying to read the array in lots of 15 as the text file has 15 columns of data.
Some of the lines only have 4 columns of data, this is throwing out my retrieval process.
Here is a sample of the text file. (copy and paste into a text file read it correctly)
seq_idlevel_idproduct_iddescription_line1description_line2description_line3description_line4supplier_idupc_apndiscount_percentbuy_price_exbuy_price_incrrp_exrrp_incGST_percent
10P1Computer Systems
20P2Workstations
30V1HEWLETT-PACKARD
40ZCOB9939XW6200 DUAL 3.2GHZ, 1GB, 40GB SATANO INTEGRATED GRAPHICSPO_3371793900.004290.0010.0
50ZCOD2329T5710 800MHZ 256/256 XPE THIN CLNTMicrosoft Windows XP Embedded; MS IE 6.0Transmeta Crusoe 800 MHz ; PC540A13.12671.38738.52772.73850.0010.0
6
Line two only has 5 tabs then the next line starts, this obviously throws out my reading of fields.
However this file can be imported into Access and all columns are correct, so I know it can be done, just not with my limited VB knowledge.
please Help,
David
Line Input #n,,<string> Stops When [null] Is In The Line
VB6. Using line input #n,,<string. to read a file. It is a txt file and the records are variable length and may contain CTRL characters. When I read a record that has a [null] in it, it takes that as a CRLF and terminates the read. I therefore get a short record and the next record read is the continuation of the first one. My reading tells me that CRLF is the terminator of a record not [null]. A stumper for me. And yes, I am sure there is no CRLF AFTER the null. I read the record character at a time and it is a null all by its lonesome.
Thanks
matt.
Question is: How can I read this record FULLY at one time. I then have to go through and change the null to a space, so it has to be in the record, otherwise everything would shift.
Get Line Form Text File 1 Line At A Time
I am trying get some code that will get one line of txt from a file then after it done with that line grab the next line so on and so forth. I have been able to get it to run through a file but I can’t get to do it one at a time. Here is some of the code I am trying to using now.
Sub TextStream ()
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, _
TristateFalse = 0
Dim fs, f, ts, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(Form1.Dialog.FileName)
Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)
Call count1 ' Mycounter1
If Mycounter1 = Mycounter2 Then
ts.SkipLine
ts.Close
Else
Call count2 ' Mycounter2
s = ts.ReadLine
Form1.Text1.Text = s
ts.Close
End If
End Sub
Trouble Reading Line By Line From A Text File
This is what i have in a text file:
1ZOOMETRIC (12) S J MILLER (56)$ 6.70$ 6.20$ 4.70$ 4.90$ 2.40
2SHIRAZAMATAZZ (6) D J STAECK (56)$ 4.00$ 4.30$ 4.30$ 4.40$ 2.00
3CONSPIRATOR (3) G L SMITH (56)$21.80$20.60$22.20$22.70$ 6.20
4KING CANUTE (11) J S WHITING (56)$44.50$47.90$50.10$53.10$10.00
5WOOL ZONE (9) P KING (56)$22.50$20.50$22.40$21.40$ 5.70
This is the code I have:
Open "c:Test.txt" For Input As #2
Do While Not EOF(2)
Line Input #2, strLine
If Len(strLine) > 30 Then
a = Len(strLine) - 11
b = Mid(strLine, a, 5)
End If
Loop
Close #2
txtOutput.Text = b
I'm trying to get it to read a line and then put the result in a RichTextBox.
Then read the next line and put the result in the RichTextBox, and so on.
The code i have only returns the result from the last line ignoring the rest e.g. "21.40"
Thanks
lurch
Capture Api Line Images And Image.line Question
how do i capture picture of my graph plotted by the polyline function(attachment below) and can anyone tell me more about image1.line command and how do i draw circle on an imagebox.
Thanks
Richtextbox : How To Change/set A Line Position To Move The Line Up/down?
I want to write a line in a Richttextbox at a specific desired Position vertically, like in a picturebox.
For a picturebox to change the print position
Code:
Private Sub Command1_Click()
Picture1.CurrentY = 100
Picture1.Print "test" ' this prints the text beginning from y axis of
' 100 pixels down.
End Sub
How can I do the same for a RTBox?
(I dont mean a newlinefeed.)
If there is a solution for this, then I should place a text in a RTBox at
any position.
Ensuring Only 65 Chars Per Line In Multi Line Textbox
I have a text box that can have any number of lines, but each line can only have 65 characters (I'm using the SendMessage API). A blank space is treated the same as a character. Right now I'm adding a carriage return at every 66th character, which works fine if I don't go back and insert or change anything I already typed in. When I do try that the cursor gets put the end of all of the text in the text box. The only way to change any text is to back space to the point where I want to retype something.
I'm curious to know if anyone can give me some ideas about how I should go about doing this.
Thanks.
I'll post my code and you will see why I get pushed to the end of the text
Private Const EM_LINELENGTH = &HC1
charcount = SendMessage(txtDetails.hwnd, EM_LINELENGTH, txtDetails.SelStart, ByVal 0&)
txtDetails.Text = Left$(txtDetails.Text, InStrRev(txtDetails.Text, " ")) & vbCrLf & Mid$(txtDetails.Text, InStrRev(txtDetails.Text, " ") + 1)
txtDetails.SelStart = Len(txtDetails.Text)
Put Specified Line By Line Number Of A Text File Into String
All I need is to put a specified line of text from a text file (by line number) into a string. Thanks
Edit: Ill explain better
example:
Code:
open "cool.txt" for input as #1
getline 3, string '<--- puts line 3 into a string called "string"
close #1
Something to that effect. Thanks again.
Reading File Line By Line With Comma's In Lines
how is this does? I need to read line by line where each line has aprox about 30+ comma's.
currently tried using
Code:
Open App.Path & "monster.txt" For Input As #1
While Not EOF(1)
Input #1, line
dbObj.Execute (line)
Wend
Close #1
Read A Word In A Line Of Text And Delete That Line
I have some aim logs that I'm going to put in .txt format, and I want to be able to delete the text that the other person has written.
Is there a way for me to specify a screen name and have the program delete that line of text?
Thanks,
Brad
New Line (vbCrLf) Leaves Symbol? / New Line Alternatives?
Hi I have a form that reads and writes date to and from a text file. The data is inputted in text boxes on the forum. At the end of reach set of records I want it to create a new line in the text file. When using vbCrLf it works but when viewing the form I get a symbol after the data that is in that textbox:
Thankyou for any help
How To Read Rich Text Box Content Line By Line
Hi all. I got a rich text box and i wonder how i can read each line of it one by one. For example i want to read each line of it and display it in massage box.
Furthermore, if i have 10 line of content in textbox how i can refrence each line and display it in massage box?
I be happy if some one show me how this can be done.Thanks
Reading A Text File Line By Line For Spellcheck
i am building a word processor. i want to build a fairly basic spellchecker. i will create a txt file with a line by line list of words that can be used and want to check each word against this. i can get a array with all the words in the program and the txt file with the dictionary in it. anyone point me in the right direction on how do this. possibly in a loop but not sure. Thanks
Send Line By Line From A Richtextbox With Brake Between Each [Solved]
Here the program I have in mind
lets say my form has one richtext box. and the user types in the first line something then hits enter goes to the second line, ect....
How I for example make it so that, when the user hits a command button, it will messege the first line, then take a 1 second brake then send the second line take 1 second brake ect...
like
MsgBox "line 1"
delay (1)
MsgBox "line 2"
delay (1)
MsgBox "line 3"
delay (1)
ect... is it posible
thanks
Loading Lines From A Text File Line By Line
I need to be able to load a line from a text file, perform actions on the line then read out the next line and perform the same actions each time adding the text to a text box, so that by the end the text box will contain all the information from the text file but formatted as to how my code formats it.
My Knowledge of VB is quite limited so explanations of how to use any code posted will probably be needed.
Thanks in advance
Run Time Error When Read File Line By Line
I'm trying to read a txt file line by line that I can stop reading at any place I want.
Below is the code:
VB Code:
Do While Not EOF(1) Line Input #1, fString Text1.Text = Text1.Text + fString + vbCrLfLoop
The problem is, if the txt file has empty lines at the end of it, it will have run time error : "Input past end of file".
Does anyone know how to solve this problem?
Thanks in advance!
* RESOLVED * Reading A File Line By Line Problem.
I'm reading a file and adding each line into a listview. I use InStr and Mid to take the first part of each line only, e.g. the text before the space. A typical line in the text file would be something similar to this:
breakers "Breakers Revenge"
In the above line, just the first part breakers is taken, which is exactly what I want. But some lines have a comma in like this:
galmidwo "Galaxian (Midway, old rev)"
In this line I want to take galmidwo which it does, but then it puts in the word "old" for the next line.
The problem I am having is that any line with a comma is treated as two lines (I think). So how can I stop this?
Code:
Dim strText As String
Open "listfull.txt" For Input As #1
Do While Not EOF(1)
Input #1, strText
pos = InStr(1, strText, " ")
strText = Mid(strText, 1, pos)
Set LItem = ListView.ListItems.Add(, , strText)
Loop
Close #1
Thanks.
Reading TextFiles Line By Line (Need To Know How To With Opening A File)
I have it setup to save the entries 1 entry per line. Now I don't know how to input the stuff in by each line. I need to do a loop as to where it will take the data from each line and put it in the appropriate textbox from each line. Please post how to do this. I have been having some problems with this.
Rich Textbox - Making A Given Line The Top Line Displayed
This is the short-and-sweet version of a question I posted earlier. Is there a way to make a given line in the rich textbox the first line displayed? (For example, if I want to display line #53 as the top line, is there a combination of methods/properties I can use to do this? I can't find any obvious technique.)
Searching For A String In A Text File Line By Line
eiSecure: The following code will work with single instances of the ~BEGIN and ~END tags, but it doesn't work with multiple instances (but you should be able to add it in if you play around with it for a bit).
VB Code:
Dim sFile As StringDim saFile() As StringDim strText As String Open "MyFile.txt" For Input As #1sFile = Input(LOF(1), 1)Close #1 saFile = Split(sFile, vbCrLf) For y = 0 To UBound(saFile) If Trim$(saFile(y)) = "~BEGIN" Then For x = y To UBound(saFile) If Trim$(saFile(x)) = "~END" Then For Z = y + 1 To x - 1 strText = strText & saFile(Z) & vbCrLf Next Z strText = strText & vbCrLf End If Next x End IfNext y Text1 = strText
Reading A Text File Line By Line ***RESOLVED***
Hi all,
I'm sure this is not as complicated as I'm making it but...
I'm trying to read a text file line by line
the text file consists of lines of data separated by commas... such as:
10,1.3,RP,15/12/00,,,,,,,
11,FF,,,SjR,15/12/00,09:26,0,,,
My code returns "10" then "1.3" then "RP" etc
I want it to return "10,1.3,RP,15/12/00,,,,,,," then "11,FF,,,SjR,15/12/00,09:26,0,,,"
VB Code:
'Open text fileOpen sFilePath For Input As #1'Loop through rowsDo While Not EOF(1) Input #1, sCurrentLine MsgBox sCurrentLineLoopClose #1
Can anyone help pls.
How To Force New Line Of Text In A Multi Line Textbox
For example, i want to print in vb like this
1. one
2. two
in c , i can do something like
printf("1. one
");
printf("2. two
");
If I need to display the same text in a VB textbox control, i must force a new line too. How could i do it in VB? Any help would be appreciated thanks in advance..
Check Every Line In Multi Line Textbox [resolved (already)]
hello again,
here i am with another problem, so i'll get straight to it.
i need to do the following code:
Code:If (Right(txtINPUT.Text, 1)) = ";" Then
for every line in a multi line textbox, as the code above just does the last character in the textbox. ive searched these forums and found nothing that is exactly what i want. ive found this but thats so much code, and im not sure if i could make that do what i want. there must be an easy way to do it, please let there be an easy way.
any help is very much appreciated.
Primary_Slave
----------------------------------------------------------------------------------------
I'm all wrapped up in my binary blanket and I'm coding on late into the night
----------------------------------------------------------------------------------------
Edited by - Primary_Slave on 10/12/2004 1:25:21 PM
File Copy Line By Line...Needs Delimiter Capability
I'm using the code below to read a file line by line, but I don't know how to get it to recognize a delimiter in the line so that I can stop reading at that point.
Private Sub Command1_Click()
Dim LinesFromFile As String, NextLine As String
Open App.Path & "TESTFILE.txt" For Input As #1 ' Open file.
Do Until EOF(1)
Line Input #1, NextLine
LinesFromFile = LinesFromFile & NextLine & vbNewLine
Debug.Print LinesFromFile
Loop
Close #1 ' Close file.
End Sub
Deleting A Line Based On What Ends The Line
I am a newbie looking to delete all lines from a file that end with 2 characters. It is very important that it only delete lines that end with these 2 characters and the lines can be any length in size. I have looked around quite a bit on her but I have been unable to find that particular instance. Any help would be appreciated.
Compare One Line To Next Line, Same File, And Do Things With It
Heyas! I have a bit of a logic problem that I'm trying to figure out, and I'm hoping someone out there has done something similar.
The issue is:
1. Read in lines from a text file.
2. Parse each line into elements of an array.
3. Do some data massaging, etc.. not too important here.
4. Stick the array elements into a string for output as a line in another text file.
5. Output that line.
6. Repeat process until end of file.
The above is easy, I've done that.
Here's the tricky part..
The first element of each line is a part number.
Sometimes, the part number on different lines (records) are the same.
If I run into multiple lines where the part number is the same, instead of just writing that info to another line, which I would do if the part numbers were different, I need to:
Write the first 7 elements of the array (common data for the records with the same part number) to a line, and the rest of the elements, say array(7) to array(15), need to be contatenated to that line.. For all of the lines (records) that have the same partnumber (first element of the array for each line).
For example, if a text file has the following structure:
PartNo1, data2, data3, data4, data5, data6, data7, ... data15
PartNo2, data2, data3, ... data15
PartNo3, data2, data3, ... data15
PartNo3, ... data15
PartNo3, ... data15
PartNo4, ... data15
etc.
For the 3 lines that start with PartNo3, I need to output only ONE line that has PartNo3, data2, data3, etc. The data up to data6 is the same for all three lines. The data after is different. The way they want me to handle data7 to data15 is to contatenate it onto the same output line. So I would have:
PartNo3, data2 to data6, data7 to data15, data 16, data 17, etc.
I cannot repeat PartNo3 to data6 in the same line, just contatenate data7 to data15 of each subsequent line with the same part number onto the same output line.
The way I've attempted to handle it is to read in a line and split it into array1, read in the next line and split it into array2, and compare the first element of the 2 arrays. If they're different, then just output one line of data with 16 elements. If they're the same, then output the first 7 elements, the next 8 elements, read in elements 8-15 from the next 2 lines, and contatenate them to the same output line. And this is where I'm running into the logic block. Things are starting to get messy, so I thought I'd come here. Maybe I'm just thick.
I apologize for the length of this post, and if I didn't explain the problem clearly enough.
If you're still with me and can see a way around the problem, I'd be very interested!
Many thanks..
Bill
Error Reading File Line By Line
i am reading the file line by line by using the following code
Dim vv
Open "c:jay.ncd" For Input As 1
Do Until EOF(1)
Line Input #1, vv
Print vv
Close 1
but i can not do that, it reads file in only 2 lines but if i open the file in wordpad and save it again then i can do it can anyone explain me why
Reading A Text File Line By Line
How would i read a text file line by line?
so far i have
Open est.txt" For Input As #1
but i dont know how to read the file into a variable =/ *confused*
Line Input Question && Line Parse ?
'I would like to change and edit
line 237 of txt file which is "Studentsnameisjohn1234567890"
'465 lines in total
Dim line1 as string
Open C: ext.text For Input As #1
Do Until EOF(1)
Line Input #1, line1
If LCase(Left$(line1, 18)) = "studentsnameisjohn" Then
Text1.Text = Mid(line1, 15, 4) ' Text 1 now displays john
End If
Loop
Close #1
If I decide to edit and parse line1 outside the loop, how do I put line1 back in to #1 after editing ?
For example entering the name "mark" in to text2.text to replace john
mid(line1, 15, 4) = text2.text 'I enter mark in textbox 2
I then click on a command button I call "Apply" to change the name which is where I am stuck as this does not happen ?
End product should look like this for line 237 of txt file "Studentsnameismark1234567890"
I would like to make the name change and then save the text file.
Any help appreciated
Really new at this...
Thx
Parse MailItem.body Line By Line
I am new at VB.
I want to make a macro that will parse through a email and pull out data and then push it to an excel file. My problem is that i can't read the body of the email line by line.
Set oApp = New Outlook.Application
Set oNameSpace = oApp.GetNamespace("MAPI")
Set oFolder = oNameSpace.GetDefaultFolder(olFolderInbox).Folders("ParseEmail")
For Each oMailItem In oFolder.Items
oMailItem.body
Next
oMailItem.body returns the whole body as a string right? how can i read the body line by line?
Looping Through A File In Word, Line By Line
Hello there. These Forms have gotten me decent with VB6 + Excel and now I have to learn Word. I've searched the forms and found how to load the word document I need to use, so that's fine. In the document there is a series of tables, and then some normal lines of text. I need to search though the normal lines of text until I find a "$" symbol. How do I loop through the lines in a word file?
Any hints would be great.
Append Line To String With Line Input
How do you append a line to a string that I am inputing text into.
Code:
Open "T:crap_email" & strfile For Input As ff 'get a handle on file
length = LOF(ff)
While Not EOF(ff)
Line Input #ff, strfiledata 'input file into a string
Wend
I know about reading the text file all at once with LOF but I am troubleshooting something, and I need to read it line by line.
Strip Down Textbox To A Line Then To Part Of The Line
Hi
i have the following in a multiline textbox:
Code:
Class: Static
hWnd: 852792
Text: [Win: ]
Class: Static
hWnd: 983772
Text: [Plrs:]
where it says "Win:" there is usally a % there, eg "Win:34%". i need to get the number "34" to textbox2.
how can i make it seach that line, and then take out all apart from the number?
thankyou!
|