91
ห้อง MS Access / : Export to Excel แล้วเราสามารถระบุชื่อเรื่องได้ไหมคะ
« เมื่อ: 13 ก.ค. 61 , 01:44:41 »โค๊ด: [Select]
Dim xlApp As Object
Dim xlWorkbook As Object
Dim xlSheet As Object
DoCmd.TransferSpreadsheet acExport, , "ชื่อคิวรี่", "พาธ\ไฟล์.xls หรือ .xlsx", True
Set xlApp = CreateObject("excel.application")
Set xlWorkbook = xlApp.Workbooks.Open("พาธ\ไฟล์.xls หรือ .xlsx")
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:E2").merge ' Merge Cells
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
โพสต์นี้ได้รับคำขอบคุณจาก: มาลี