Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21271

Handling .txt files with VB6

$
0
0
Hi,

I want to call a subroutine in my VB6 app when an event occurs and append some data to a txt file. I have the following code which I want to open a .txt file that resides in a folder (with full permisisons) based on this week's number and the year.

Code:

Public Sub BadgeLog()
Dim d As Date
Dim Week As Integer
Dim YearNow As Integer
Dim Path As String
d = dateTime.Now
Week = DatePart("ww", Now())
YearNow = Year(Now)
Path = "\\server\folder\sub_folder\sub_folder\sub_folder\sub_folder\" + YearNow \ " + Week\tracking.txt"

    Open "Path" For Append As #1
                Print #1, d, MFGLINE$
                Close #1
End Sub

Problem is, I get an error when my event triggers. I'm thinking my syntax is wrong somewhere but my VB knowledge is very limited. Can you give me some guidance? thanks.

Viewing all articles
Browse latest Browse all 21271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>