我想制作一个 VBSript,它将打开一个包含不同行和列的 csv,并从第 4 行第 1 列开始粘贴它们。到目前为止,我写的内容很慢,并且有很多列硬编码到其中。
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(wscript.Arguments(0))
objExcel.Visible = True
objExcel.Cells(1, 4).Value = wscript.Arguments(1)+" - "+wscript.Arguments(2)
objExcel.Cells(2, 4).Value = wscript.Arguments(3)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile (wscript.Arguments(4))
cCount = 1
rCount = 4
Do While objTextFile.AtEndOfStream <> True
arrUserRecord = split(objTextFile.Readline, ",")
Do While cCount<213
objExcel.Cells(rCount, cCount).Value = arrUserRecord(cCount-1)
cCount=cCount+1
Loop
cCount=1
rCount=1+rCount
Loop