|
-
May 31st, 2001, 09:50 AM
#1
Thread Starter
Member
Get a piece of text into a *.txt file
Hello everybody
How can I get a piece of text into a *.txt file ?
For example : "The sky is blue, the sun is shine. We are in summer !" give "the sun is shine", for example.
Thank you very much for your answer if you can.
-
May 31st, 2001, 12:36 PM
#2
It's not clear what you want:
My best guess: Find a substring
Code:
str = "The sky is blue, the sun is shine. We are in summer !"
p = instr(str,"the sun is shine") ' p marks the start of the substring
-
May 31st, 2001, 02:11 PM
#3
Then to save it:
Code:
Open "MyFile" For Output As #1
Print #1, MyText
Close #1
-
Jun 1st, 2001, 03:28 AM
#4
Thread Starter
Member
Get a piece of text into a *.txt file (substring).
In fact, I need a function can retrieve the target of a shortcut file. To do this, I open the *.lnk file (as binary) to extract the informations and put them into a *.txt file. I need to find a substring (the target) which is into the text file.
Here is the begin :
Private Sub Command1_Click()
Dim var As String
'For example, the desktop shortcut "Write.lnk" open Notepad.
Open "C:\Windows\Desktop\Write.lnk" For Binary As #1
var = Space(LOF(1))
Get #1, , var
Close #1
'var contain the shortcut file information.
'I save it with .txt extension so it is easy to open it with notepad.
Open "C:\Windows\Desktop\Result.txt" For Binary As #1
Put #1, , var
Close #1
End Sub
'Now, how can we find the target (C:\Windows\Notepad.exe for this example) which is in Result.txt ?
Thank you in advance for your help.
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
|