Как взять информацию из базы данных VB и
поместить её в таблицу Excel
Private Sub Excel_Spreadsheet(rst As Recordset)
'Declare all Excel objects
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Dim xlWS As Excel.Worksheet
Set xlApp = New Excel.Application
Set XLWB = xlApp.Workbooks.Add
Set xlWS = xlWB.Worksheets.Add
'Fill cells using recordset
xlWS.Cells(1,1).Value = rst("Field1")
xlWS.Cells(2,1).Value = rst("Field2")
' save spreadsheet
xlWS.SaveAS "mysheet.xls"
xlApp.Quit
' Free memory
Set xlWS = Nothing
Set xlWB = Nothing
Set xlApp = Nothing
End Sub
|