tuanvr > 12-08-22, 11:54 PM
Dim appExcel As Object
Dim xlsx As Object
Dim sFileName As String
Dim sTemp As String
Dim xlsPath As String String
Dim s$
stemp=CurrentProject.path & "\TempHS\"TPTB.xlsx"
xlsPath = sTemp
Set appExcel = CreateObject("Excel.Application")
Dim xlBook As Object
On Error Resume Next
Set xlBook = appExcel.Workbooks.Open(xlsPath)
Set xlsx = xlBook.Worksheets("TP")
With xlsx
.Range("D6").Value = Me.txtChuPT
.Range("Y6").Value = Me.txtDC
.Range("G5").Value = Me.txtTenTau
.Range("AJ5").Value = Me.cboKH
.Range("Z9").Value = Me.txtDT
.Range("AC65").Value = Day(Now())
.Range("AH65").Value = Month(Now())
If Me.otpCPK = True Then
.Range("AG61").Value = Me.txtSum.Value * 1000
.Range("D63").Value = Me.txtDiengiai
End If
.SaveAs fileName:=spath & sFileName
End With
s = """" & spath & sFileName & """"
Shell "C:\windows\explorer.exe " & s, 1
appExcel.Quit
Set appExcel = Nothing
End Sub