我正在寻找能够自动将所有列组合成单个列,从表到列的VBS ...感谢您的支持。
ROW1 | A D G
ROW2 | B E H
ROW3 | C F I
预期结果:
一个
乙
ç
d
Ë
˚F
摹
^ h
我
答案 0 :(得分:0)
你可以从这样的事情开始:
Option Explicit
'Var's Used
Dim oXLApp, oSheet, sXlFile, sWorkSheet, iStartRow, iEndRow
Dim iStartColumn, iEndColumn, iRowIndex, iColIndex, sValue
'Set file path and name to excel file that contains the data
sXlFile = "E:\Sample.xls"
sWorkSheet = "Sheet1"
'Set the start & end rows and columns
iStartRow = 1
iEndRow = 3
iStartColumn = 1
iEndColumn = 3
'Create the excel object
Set oXLApp = CreateObject("Excel.Application")
'Make it visible
oXLApp.Visible = True
'Open the workbook
oXLApp.Workbooks.Open(sXlFile)
'Create the worksheet object
Set oSheet = oXLApp.Sheets(sWorkSheet)
'Row loop
For iRowIndex = iStartRow To iEndRow
'Column loop
For iColIndex = iStartColumn To iEndColumn
'Get the Value of the cell
sValue = oSheet.Cells(iRowIndex,iColIndex).Value
'So something with the value
WScript.Echo sValue
Next
Next
'Distroy the sheet object
Set oSheet = Nothing
'Close the workbook
oXLApp.Workbooks.Close
'Exit Excel
oXLApp.Quit
'Distroy the XLApp object
Set oXLApp = Nothing