1
我有excel文件(VBA),我希望在單獨的文件中輸出,但我努力使其追加。 輸出應該是工作表中第6行以下的所有內容。將VBA中的輸出從Activesheet更改爲新文檔(文件)
Set RST = New ADODB.Recordset
RST.Open SQL, mCON, adOpenForwardOnly, adLockReadOnly, adCmdText
Do Until RST.EOF = True
Application.StatusBar = "Getting data to row: " & lRow
For n = 0 To (RST.Fields.Count - 1)
If Not IsNull(RST(n)) Then ActiveSheet.Cells(lRow, n + 1) = RST(n)
Next
RST.MoveNext
lRow = lRow + 1
Loop
ActiveSheet.Range("B5").Select
Application.ScreenUpdating = True
Exit Sub