I'm new to VB scripting though I have a little familiarity in VBA.
The VBA code which I have written is working fine but when I tried to convert it into VBS file it throws Run time error "Expected End of Statement- 800A0401" in the following line
wb.Worksheets(1).Cells(1, f2) = get_split_strings(0) & "pass %"
get_split_strings(0) is an array and what I want to do is append the string "pass %" to it.What I am actually doing is opening a HTML file as a excel file for processing and saving it back as a HTML file.
Set wb1 = CreateObject("Excel.Application")
Set wb = wb1.Workbooks.Open("file:///Pathname/filename.html")
If (f1 + 1) = lastrow And (f2) < lastcolumn Then
wb.Worksheets(1).Cells(f1 + 1, f2) = Round((Per_Sum / (lastrow - 2)), 0)
wb.Worksheets(1).Cells(1, f2) = get_split_strings(0) & "pass %" **Getting Error here**
f2 = f2 + 3
f1 = 1
Per_Sum = 0
End If
Added as per comment
get_split_strings(0) = Split(wb.Worksheets(1).Cells(1, f2), "_", -1, vbBinaryCompare)
get_split_strings(0) contains the header contents. Basically a string data. In the above line the value of f2 is incremented to parse through the columns to find the header contents.
It worked with a small work around.Removed the usage of get_split_string(0).
wb.Worksheets(1).Cells(1,f2)= wb.Worksheets(1).Cells(1,f2) & " pass %"
excel.applicationobjectin your VBS script?get_split_strings(0)?