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
'*******************************************************************
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
'*******************************************************************