View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Christof[_5_] Christof[_5_] is offline
external usenet poster
 
Posts: 4
Default VB how to connect two sub's

Hi there everyone

I am a noob in this program, although I have created one sub myself
and got help with another sub. What I want to do now, is to connect
them. I couldn't do it without getting error-messages.

Hope u can help me to do so or make alternative suggestions
__________________________________________________
Part 1:
Sub MakeList()

Const file1 = "P:\temp\oldtest.txt"
Const file2 = "P:\temp\newtest.txt"
Const ForWriting = 2

Dim Text
Dim fso, fi1, fi2

Set fso = CreateObject("Scripting.FileSystemObject")

If fso.FileExists(file1) Then
Set fi1 = fso.OpenTextFile(file1)
Set fi2 = fso.OpenTextFile(file2, ForWriting, True)

Do While Not (fi1.atEndOfStream)
Text = fi1.Readline
fi2.WriteLine (Text)
Loop

End If

End Sub
__________________________________________________
Part 2:
Sub MakeURLText()

Dim FName As String
Dim Fnum As Long
Dim NewText As String
Dim MyURL As String

FName = "P:\temp\newtest.txt"
Fnum = FreeFile

NewText = "( "

Open FName For Input As Fnum

Do While Not EOF(Fnum)
Line Input #Fnum, MyURL

NewText = NewText & "url contains " & Chr(34) _
& MyURL & Chr(34) & " or "
Loop

Close Fnum

NewText = Left(NewText, Len(NewText) - 4) & " )"

FName = "P:\temp\newtest.txt"
Fnum = FreeFile

Open FName For Output As Fnum

Print #Fnum, NewText

Close Fnum

End Sub


hope u can help me, thx for your attention :)

Greets, Christof