91
ห้อง MS Access / : ขอคำสั่ง insert ข้อมูล ตามเงื่อนไขที่กำหนดค่ะ
« เมื่อ: 07 ส.ค. 61 , 06:42:41 »
เย้..สำเร็จได้ผลตามที่ต้องการแล้วค่ะ
ขอขอบคุณอาจารย์นะคะ
ขอขอบคุณอาจารย์นะคะ
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Private Sub Command0_Click()
Dim xlApp As Object
Dim xlWorkbook As Object
Dim xlSheet As Object
DoCmd.TransferSpreadsheet acExport, , "Query1", "D:\ExportQuery1.xls", True
Set xlApp = CreateObject("excel.application")
Set xlWorkbook = xlApp.Workbooks.Open("D:\ExportQuery1.xls")
Set xlSheet = xlWorkbook.activesheet
With xlSheet.range("A1")
.entirerow.insert -4121 ' Insert and Shift Row Down
.entirerow.insert -4121 ' Insert and Shift Row Down
xlApp.DisplayAlerts = False
xlSheet.range("A1:F2").merge ' Merge Cells (ผสานเซล A1:F2)
xlApp.DisplayAlerts = True
End With
With xlSheet.range("A1")
.Value = "ชื่อหัวเรื่องที่ต้องการ"
.Font.Name = "Tahoma"
.Font.Size = 18
.Font.Bold = True
.HorizontalAlignment = -4108 ' Align Center
End With
With xlSheet
.Columns("A").ColumnWidth = ......
.Columns("B").ColumnWidth = ......
.Columns("C").ColumnWidth = ......
.Columns("D").ColumnWidth = ......
.Columns("E").ColumnWidth = ......
.Columns("F").ColumnWidth = ......
End With
xlApp.ActiveWorkbook.Close True
End Sub