Godspear > 31-03-17, 10:28 AM
chuvoicon > 31-03-17, 11:42 AM
Private Sub xuat_Click()
On Error GoTo xuat_click_err
Me.kehoachmayinsub.SetFocus
DoCmd.GoToControl "sophieu"
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdCopy
Dim xlapp As Excel.Application ' ap dung cho ecxel 2003
Dim text As String
text = UniConvert("Khoong tifm thaasy file. " & vbCrLf & "Haxy tajo file cos teen 'kehoachsanxuat.xls' trong thuw mujc chuwsa file chuwowng trifnh quarn lys sarn xuaast.", "telex")
Set xlapp = CreateObject("Excel.Application")
With xlapp
.Workbooks.Open (Application.CurrentProject.path + "\kehoachsanxuat.xls")
.Worksheets.Add
.Range("a4").Select
.Range("a4").PasteSpecial Paste:=xlPasteValues
.Cells.Select
.Cells.EntireColumn.AutoFit
.Visible = True
.Range("a4").Select
End With
xuat_click_exit:
Exit Sub
xuat_click_err:
MsgBox text, vbInformation
Resume xuat_click_exit
End Sub
Godspear > 03-04-17, 07:43 AM
(31-03-17, 11:42 AM)chuvoicon Đã viết:Mã PHP:Private Sub xuat_Click()
On Error GoTo xuat_click_err
Me.kehoachmayinsub.SetFocus
DoCmd.GoToControl "sophieu"
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdCopy
Dim xlapp As Excel.Application ' ap dung cho ecxel 2003
Dim text As String
text = UniConvert("Khoong tifm thaasy file. " & vbCrLf & "Haxy tajo file cos teen 'kehoachsanxuat.xls' trong thuw mujc chuwsa file chuwowng trifnh quarn lys sarn xuaast.", "telex")
Set xlapp = CreateObject("Excel.Application")
With xlapp
.Workbooks.Open (Application.CurrentProject.path + "\kehoachsanxuat.xls")
.Worksheets.Add
.Range("a4").Select
.Range("a4").PasteSpecial Paste:=xlPasteValues
.Cells.Select
.Cells.EntireColumn.AutoFit
.Visible = True
.Range("a4").Select
End With
xuat_click_exit:
Exit Sub
xuat_click_err:
MsgBox text, vbInformation
Resume xuat_click_exit
End Sub
Đây là một cách xuất excel với code của anh em đã up trong chương trình, bạn có thể search trong diễn đàn những ji bạn cần đều có cả.
Thân
ongke0711 > 03-04-17, 04:11 PM