Help Returning Line Set?
Hi, i have the following problem.
I have a 6 multine textboxes not linked to eachother in any way, EXCEPT.. that they contain information wich is related to eachother..
like this :
text1: text2: text3: etc
info1 info2 info3
info1 info2 info3
info1 info2 info3
info1 info2 info3
as you can see, the first line of text1 .. contains information relevant to the same line in text2/text3/text4/text5/text6.
if you still dont understand 1 more example :
say we have a chair.. and we put it in a table.
colour type serial
blue antique 123-3472
red old-style 234-4567
now i want those information bits to be linked to eachother by counting the lines on wich they exist.
say i would want to see what would exist on lines 100~200
so therefor i would need it to do this :
1. Count the lines in text1 , start reading from line 100 .. and stop at line 200
2. print those in any way ( im going to write them to a textfile ).
3. then do point 1 for text2 till text6. and print those also.
how would i go by this?
i know how to count the lines and all that
Private Sub Count_Click()
Dim Pieces1() As String
Dim string1 As String
Dim lines As Integer
Dim i As Integer
string1 = Text1.Text
Pieces1 = Split(string1, vbNewLine)
For i = LBound(Pieces1) To UBound(Pieces1)
lines = lines + 1
Count.Text = lines
but then i wouldnt know how to read the content of that single line, and even how to read multiple lines.
Please help me with this!
Jeroen van Vierzen
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Returning Value To Cmd Line In VB6
I have a VB6 executable that I am running from a cmd line. I need to return a value (or two) to the cmd shell. Does anyone know how to do this?
Returning Command Line Parameters
Hello, I'm hoping someone can help me out here! The Visual Basic project I am developing is called from a SQL Function through the xp_cmdShell command. I know how to read in parameters through Visual Basic but what I need to do is return a value to SQL so that SQL knows whether or not to start the next DTS Package.
For example, I have a flag that is set to either 0 (meaning everything completed successfuly) or 1 (meaning something failed) within my visual basic program. What I need is a way I can return that value to SQL after SQL executes the xp_cmdShell command
Here is a rough sketch of how the process works:
SQL Job A is scheduled to run every day at 9:00 a.m.
Job A creates temp tables
Job A then calls out the vb program (variables declared earlier in function)
SELECT @Cmd = 'C:MyVBProgramMyProgram.exe'
EXEC @FinalValue = master..xp_cmdshell @cmd, no_output
IF @FinalValue <> 0
SELECT @ErrString = 'Application failed!'
RAISERROR('%s', 16, 1, @ErrString)
Job A (if @FinalValue = 0) will continue on running a DTS package that takes the data created by the vb app and stores the data in the temp table, then stores the data into production tables, and is then complete. But if Job A @FinalValue = 1, then the process will stop and e-mail me that it's failed.
What I need to know how to do, if anyone can help, is find out how I can return a value from Visual Basic as @FinalValue. No matter what I try, it always returns a 0 because the command opened the program successfully (so it thinks everything is fine), even if the program crashes.
Thanks in advance, any help would be great!
Finding A Specific Word In A Variable, Then Returning The Whole Line
I've a program that gives this information:
Cdrecord-Clone 2.01.01a01 (i686-pc-cygwin) Copyright (C) 1995-2004 Jörg Schilling
Using libscg version 'schily-0.8'.
0,0,0 0) 'ST320410' 'A ' '3.39' Disk
0,1,0 1) *
0,2,0 2) *
0,3,0 3) *
0,4,0 4) *
0,5,0 5) *
0,6,0 6) *
0,7,0 7) HOST ADAPTOR
1,0,0100) 'LG ' 'CD-ROM CRD-8485B' '2.00' Removable CD-ROM
1,7,0107) HOST ADAPTOR
How would I be able to find all "CD-ROM" drives, and use that whole line? What I'm trying to do is show the CD drive ('LG ' 'CD-ROM CRD-8485B'), and have the ID (1,0,0) attached with it, but not have it the ID shown in a list box.
Returning The Final Line Of A Text File To Excel..
I'm a newbie to VB and am trying to write a script that searches a directory and returns (a) Filename (b) Row count and (c) the final Line of the text file (which in all cases concened is 6 characters)
So far I've got:
Dim SourceFile As String
Dim LFile As Integer
Dim strBuffer As String
LFile = FreeFile
Set fs = Application.FileSearch
.LookIn = "C:2005"
.Filename = "*.sls" 'Was "*.txt"
.SearchSubFolders = True
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
SourceFile = .FoundFiles(i)
Open SourceFile For Input As LFile
Do While Not EOF(LFile)
Input #LFile, strBuffer
intlinesReadCount = intlinesReadCount + 1
Worksheets("SCP 2005").Cells(i + 5, 1) = .FoundFiles(i)
Worksheets("SCP 2005").Cells(i + 5, 2) = intlinesReadCount - (2 * i)
MsgBox "There were no files found."
Now this returns the correct filenames and row counts, but I'm stuck as to how to return the final line of the file into "Worksheets("SCP 2005").Cells(i + 5, 3)" now.....
One more thing I'm very lost on (I've not got very far with string manipulation yet)...
each row of the data within the files contains a variable value in characters 88&89, either "00" or "79" - how can I count how many lines have the 79 variable in them and return this too?
Any help would be much appreciated!!!
Recordset Only Returning Five Records When It Should Be Returning 466
Doing this in excel with VBA. Haven't working in VBA for a very long time but can't see why I'm getting these results.
I run this sql in query analizer and I get 466 records back but when the same sql runs in vba I only get five records back. I checked the conn string to make sure I was running against the correct db. Is it that I'm not setting up my recordset object correctly?
Set conSql = New ADODB.Connection
conSql.Provider = "SQLOLEDB"
conSql.ConnectionString = "Data Source = Test1;" & "User ID=sa;Password=test; Initial Catalog = test;"
'conSql.ConnectionTimeout = 120
Dim strSql As String
Dim fldField As ADODB.Field
Dim docXML As New MSXML2.DOMDocument
Set rstData = New ADODB.Recordset
strSql = "SELECT CedingCoID, effectivedate, XMLString " & _
"FROM CAPSProgram " & _
"Where ID > 1 and CedingCoID > 1" _
' "WHERE (CedingCoID = '" & intCedingCoID & "' AND EffectiveDate = '" & CDate(datEffectiveDate) & "' AND Description " & IIf(strDescription = vbNullString, "IS NULL)", " = '" & strDescription & "')")
rstData.Open strSql, conSql, adOpenForwardOnly, adLockReadOnly
'Set rstData = conSql.Execute(strSql)
Do Until rstData.EOF
' If Not rstData.EOF Then
globEffectiveDate = rstData.Fields("effectivedate").Value 'set global effective date for future use
docXML.LoadXML (rstData.Fields("XMLString").Value) 'load glabal xmldoc for all load routines
globCedingCoID = rstData.Fields("CedingCoID").Value
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.
p.s. please email replys in addition to the reply of post too
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.
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..
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
Needing Experienced Programmer For Help - Parsing && Changing Line By Line In Txt File
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
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
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..
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
The MsgBox should say for example:
Footnote 1: carriage return, page 7
Footnote 2: carriage return, page 9
Could please somebody give me a hint ? Thank you very much in
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.
.Input ( Read Contentsof Text File - Line By Line )
I'm trying to import Data from a text file, which includes the following,
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
Open "YourFile.txt" For Input As #1
While Not EOF(1)
Input #1, YourVariable
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 ).
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.
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
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
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)
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
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.
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.
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
Call count2 ' Mycounter2
s = ts.ReadLine
Form1.Text1.Text = s
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)
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"
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.
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
Private Sub Command1_Click()
Picture1.CurrentY = 100
Picture1.Print "test" ' this prints the text beginning from y axis of
' 100 pixels down.
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
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.
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
open "cool.txt" for input as #1
getline 3, string '<--- puts line 3 into a string called "string"
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
Open App.Path & "monster.txt" For Input As #1
While Not EOF(1)
Input #1, line
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?
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...
MsgBox "line 1"
MsgBox "line 2"
MsgBox "line 3"
ect... is it posible
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:
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?
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)
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).
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***
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:
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,,,"
'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
in c , i can do something like
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)]
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.
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
Close #1 ' Close file.
I'm using the following command to make a sum from a range of cells.
Dim Pa As Integer
ActiveCell.Offset(1, 5) = WorksheetFunction.Sum(Sheets("BOMA").Range("F5", Sheets("BOMA").Cells(Range("F65536").End(xlUp).Row + 1, 6)))
Pa = ActiveCell.Offset(1, 5)
The program return an error and stops at Pa = ....
Debug shows that Pa = 0 even though the sum in this cell are something else.
Returning From A Sub
Can any one tell me is there a way to return from a sub function
is there a way to return to the place in another function where I called this sub from?
if not is there another way I can run the same procuder and come back to my starting point?
Returning A Value From A Sub?
well I have something along the lines of
public sub returnTest(theNum As integer)if theNum = 1 then'return something elseend ifexit sub
But, I don't know how to return something in vb.
I would like to use this sub like..
testVar = returnTest(1)
Returning A Value From An Exe
I am trying to make an exe which returns a value to the command prompt when run through the command line. I am using cmd line parameters..