user3276905
user3276905

Reputation: 59

error while running .vbs on windows, expected ')' vb script

Can you please tell what is wrong with following VBScript? I'm getting this error: error expected ')'

VBScript:

Const strSourceFile = "C:\Temp\test.txt"
Const strTargetFile = "C:\Temp\test.csv"
Dim strData
Dim objFSO, objSourceFile, objTargetFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSourceFile = objFSO.OpenTextFile(strSourceFile, 1, True)
Set objTargetFile = objFSO.CreateTextFile(strTargetFile, True)

Do While Not objSourceFile.AtEndOfStream
    strData = objSourceFile.ReadLine
    'msgbox strData

    Dim strName, strAddress, strCity, strState, strZip

    strName = Trim(Mid(strData, 1, 20))
    strAddress = Trim(Mid(strData, 21, 20))
    strCity = Trim(Mid(strData, 41, 20))
    strState = Trim(Mid(strData, 61, 2))
    strZip = Trim(Mid(strData, 63 5))

    objTargetFile.WriteLine("""" & strName & """,""" & strAddress & """,""" & strCity & """,""" & strState & """,""" & strZip & """")
Loop

msgbox "done!"

Upvotes: 0

Views: 132

Answers (1)

Thomas
Thomas

Reputation: 383

Maybe

strZip = Trim(Mid(strData, 63, 5))

(missing comma)

Upvotes: 1

Related Questions