I use DAO to import data in Data into the Excel object you created.
Sub TableToExcel (nTableName As Integer, nTableData () As Integer) FrmQuarterTable.MousePointer = 11 On Error Resume Next Dim i As Integer Dim j As Integer Dim strYear As String Dim strSeason As String Dim xlApp, xlBook, xlSheet As Object On Error Resume Next Set xlApp = CreateObject ( "Excel.Application") Set xlBook = xlApp.Workbooks.Add Set xlsheet1 = xlBook.worksheets (1) xlApp.activewindow.tabratio = 0.9 Select Case nTableName Case 11: xlBook.worksheets ( "sheet1"). SELECT XLAPP.Activesheet.Range ("B1: H1"). Select Xlapp.activecell.formular1c1 = "Table 1-1"
XLapp.selection.font.name = "black body" xlapp.selection.font.fontstyle = "bold" xlapp.selection.font.size = 18 xlapp.selection.Merge with xlapp.activeesheet.Range ("A2: i13"). Borders' Border Set. LinesTyle = 1 'xlborderLineStyleContinuous .COLORINDEX = 5' Border is black = 1
Blue = 5 .weight = 2 'xlthin end with xlbook.worksheets ("sheet1") .Cells (2, 3) = "new patient (1)": .cells (2, 4) = "Recurrence (2) ":
.cells (2, 5) = "recovery (3)":
.cells (2, 6) = "Bulmination failed (4)": .cells (2, 7) = "move
(5) ":
.Cells (2, 8) = "Other (6)": .cells (2, 9) = "Total (7)" .Cells (3, 2) = "Gemwan": .Cells (6, 2) = "Guanzhi": .cells (9,
2) = "Preliminary" .Cells (4, 2) = "Removers": .cells (7, 2) = "Removers": .Cells (10, 2) = "Realination" .Cells (5, 2) = "Small Meter": .cells (8, 2) = "Small Meter": .Cells
(11, 2) = "Small Meter". Cells (2, 1) = "": .RANGE ("A2: B2"). SELECT:
XLapp.Selection.Merge .Cells (3, 1) = "阳": .range ("A3: A5"). Select:
XLapp.Selection.Merge .Cells (6, 1) = "Apply": .range ("A6: A8"). SELECT:
XLapp.Selection.Merge .Cells (9, 1) = "No Catch": .range ("A9: A11"). SELECT:
XLapp.Selection.Merge .Cells (12, 1) = "pleurisy": .range ("A12: B12"). SELECT:
XLapp.Selection.Merge .Cells (13, 1) = "Other": .range ("A13: B13"). SELECT:
XLapp.Selection.Merge .Columns ("f: f"). ColumnWidth = 13.RANGE ("A1: I13"). Select with xlapp.selection .horizontalalignment = -4108 'Level
MediatiTicalAlignment = -4108 'vertical
End with for i = 3 to 13 for j = 3 to 9 .Cells (i, j) = NTABLEDATA (i - 1, j) Next Next with Case 12: ............ ...
Case 13: .....................
End SELECT
For i = 0 to 12 for j = 0 to 11 ntabledata (i, j) = 0 Next Next xlapp.visible = true frMquartertable.mousepointer = 1
End Sub
I am eager to teach! ! . . WOLF_COMING@126.com
QQ 15433677