Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying text from notepad and outputting as .txt with tags

Status
Not open for further replies.

Bilbomanator

Programmer
Apr 27, 2004
1
US
Hi, I don't know VB6 in and out yet, so some of the answers may get over my head.

I have a basic text file with a system like this
"
*hello*howdy*me*you*
"

Something like that, where the data are seperated by asterisks.

What I need to do is be able to copy only the "hello howdy me you" into the clipboard maybe then output it to another textfile with tags so it can be brought into Ventura10.

I do not yet know what the output is going to be like but maybe something like this
"
<tag><bold><arial>hello</tag>

"
Something where I can make the tags in VB and have it output it to that.

At least something so i can manipulate it myself.

I have tinkered around and gotten notepad open and opened a file. I have had no luck in just copying out the data from notepad into another file.

I can copy the data from notepad into vb into a txtbox, but that is it.

If anyone can steer me in the right direction, this would greatly help me out at work.

Thank you very much
-Matt
 
Is there a reason why you're using notepad and not a textbox in your VB app? Reading the file into a variable and working with it from there would probably be better.

Somnething like this ...

Dim astrLines() As String
Dim intFile As Integer
Dim strBuffer As String

' Read contents file
intFile = FreeFile()
Open "Put you filename here" For Binary As #intFile
strBuffer = Space$(LOF(intFile))
Get intFile, , strBuffer
Close #intFile

' Replace special characters and split into lines
astrLines = Split(Replace(strBuffer, "*", " "), vbCrLf)

This will leave you with an array of the line contained in the file. The lines will have spaces instead of *.


Net_Giant

What fun is a technology if you can't crash the OS?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top