# 中繼器
###### tags: `CTBC-RPA-Lab1`
帳號 :
UAT00036
密碼 :
JANjan02
```vb
Public Sub getFirstRow(參數1 As String)
'關閉彈跳視窗
Application.DisplayAlerts = False
'關閉詢問是否要更新連結
Application.AskToUpdateLinks = False
'開啟template檔案
Dim newExcel As Excel.Application
Set newExcel = New Excel.Application
Dim templateWB As Workbook
Set templateWB = newExcel.Workbooks.Open("C:\CRPADATA\1.IWEB\報表查詢.xlsx")
newExcel.Visible = False
Dim rowCount As Integer
rowCount = 2
Dim columnCount As Integer
columnCount = 1
'將A列改為文字
templateWB.Worksheets(1).Columns(1).NumberFormat = "@"
'寫入資料
arrStr = Split(參數1, ",")
'For i = 1 To UBound(arrStr)
'MsgBox (UBound(arrStr))
For I = 6 To UBound(arrStr)
If columnCount = 6 Then
rowCount = rowCount + 1
columnCount = 1
End If
templateWB.Worksheets(1).Cells(rowCount, columnCount) = arrStr(I) + "" '把字串儲存到儲存格
columnCount = columnCount + 1
Next
'計算總row數
templateWB.Worksheets(1).Range("I1").Value = "資料筆數"
Dim LastRow As Integer
LastRow = ActiveSheet.UsedRange.Rows.Count
templateWB.Worksheets(1).Range("I2").Value = LastRow
templateWB.SaveAs "C:\CRPADATA\1.IWEB\開發中心_OOO.xlsx"
templateWB.Close
newExcel.Quit
Set templateWB = Nothing
Set newExcel = Nothing
End Sub
```