Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 函数创建新行和新列_Windows_Csv_Vbscript_Windows Scripting - Fatal编程技术网

Windows 函数创建新行和新列

Windows 函数创建新行和新列,windows,csv,vbscript,windows-scripting,Windows,Csv,Vbscript,Windows Scripting,我正在尝试创建一个函数来写入内容,在csv输出文件中创建新行和新列 以下是我的功能: Function WriteOutputToCSV(strCSVOutput) 'Check if file exists & write the data On Error Resume Next Set objUserCSV = objCSV.OpenTextFile(UserCSV, ForAppending) If objCSV.FileExists(UserCSV) Then If

我正在尝试创建一个函数来写入内容,在csv输出文件中创建新行和新列 以下是我的功能:

Function WriteOutputToCSV(strCSVOutput)
'Check if file exists & write the data
On Error Resume Next

Set objUserCSV = objCSV.OpenTextFile(UserCSV, ForAppending)

If objCSV.FileExists(UserCSV) Then
   If CStr(strCSVOutput) = "*newline*" Then
    objuserCSV.Write vbcrlf
   Else if CStr(strCSVOutput) = "*newcolumn*" Then
    objuserCSV.value(columncount,1)="***"
    objuserCSV.Write vbcrlf
    columncount = columncount+1
   Else
    If CStr(InStr(1,strCSVOutput, ",")) Then
        strCSVOutput = Chr(34) & strCSVOutput & Chr(34)
    ElseIf CStr(Trim(strCSVOutput)) = "" Then
        strCSVOutput = " " 
    End If  
    objUserCSV.Write strCSVOutput & ","
   End If
Else    
' file DNE
End If

objUserCSV.Close
End Function

但它不起作用(语法错误是在“'file DNE”前面的第行缺少一个结尾,我不知道为什么它是错的),我也不认为新的列1起作用。有什么帮助吗?谢谢

Else
if
之间有一个不应该存在的空格。这一行:

Else if CStr(strCSVOutput) = "*newcolumn*" Then
应假定为:

ElseIf CStr(strCSVOutput) = "*newcolumn*" Then