|
使用以下方法从ACCESS导出数据并打开EXCEL文件后,EXCEL文件的当前SHEET是与上一次保存时的状态有关系,而并非肯定是这次导出的SHEET(如A),请问应该使用什么语句才能激活本次导出数据的SHEET?谢谢!
Dim path As String
path = CurrentProject.path & "\excel.xls"
Set oApp = CreateObject("Excel.Application")
oApp.Visible = False
Set oappwork = oApp.Workbooks.Open(path)
Set oappwork_itez = oappwork.Worksheets("A")
With Me.[NewSmall_3Subform].Form.Recordset
.MoveFirst
nn = .Fields.Count
j = 8
Do
If .EOF Then
Exit Do
Else
For i = 0 To nn - 1
oappwork_itez.cells(j, 5 + i) = .Fields(i)
Next i
j = j + 3
.MoveNext
End If
Loop
MsgBox "ok", vbOKOnly + vbInformation
oApp.Visible = True
End With
On Error Resume Next
oApp.UserControl = True
|
|