|
-
Nov 18th, 1999, 04:34 AM
#1
Thread Starter
Hyperactive Member
I have a text box that contains about 200 lines. some are ended by a return and others are word wraped. I need to take the text in this text box and save it as a return delimited file. Is it possible to take each line one at a time and save it out to a file. If the line has a hard return I just save it. If the line was word wrapped I would add a return at the end of the line.
I am doing this so that I can import this text into AutoCAD. I want each line to be 65 characters or less, which is what the text box is displaying.
thank you for your time and have a good day
------------------
I am so skeptacle, I can hardly believe it!
-
Nov 18th, 1999, 10:59 AM
#2
Try this, it Outputs the Text As Is..
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_GETLINE = &HC4
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_LINELENGTH = &HC1
Private Sub Command1_Click()
Dim iLines As Long
Dim iLine As Integer
Dim iFile As Integer
Dim sLine As String
iFile = FreeFile
Open "C:\Export.txt" For Output As iFile
iLines = SendMessage(Text1.hwnd, EM_GETLINECOUNT, 0&, ByVal 0&)
For iLine = 0 To iLines - 1
sLine = Space(SendMessage(Text1.hwnd, EM_LINELENGTH, iLine, ByVal 0&))
Call SendMessage(Text1.hwnd, EM_GETLINE, iLine, ByVal sLine)
Print #iFile, sLine
Next
Close iFile
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|