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

Expected end of statement

$
0
0
I'm trying a very simple script to output headings to a txt file. I know I'm missing easy as I'm still learning.

I want my out put to be below in a TXT File, but I get "Expected end of statement" when i run it.

IP Address|Subnet Mask|DHCP Server|DNS Suffix|AD Site

My Code is below

'*******************************************************************

Call WriteToTextFile(strHeadings,strPath)

strHeadings = cStr"IP Address|" & "Subnet Mask|" & "DHCP Server|" & "DNS Suffix|" & "AD Site"
strPath = "C:\scripts\output\table.txt"



Function WriteToTextFile(strPath,strHeadings)

Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fso, MyFile, FileName, TextLine

Set fso = CreateObject("Scripting.FileSystemObject")

' Open the file for output.
FileName = strPath

Set MyFile = fso.OpenTextFile(FileName, ForAppending, True, TristateTrue)

' Write to the file.
MyFile.WriteLine strHeadings
MyFile.Close

MyFile.Close

End Function


'*******************************************************************

Viewing all articles
Browse latest Browse all 21237

Trending Articles



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