danhxetnghiem > 20-03-14, 02:25 PM
Xuân Thanh > 20-03-14, 04:10 PM
ttm20062008 > 20-03-14, 04:58 PM
nhannt4 > 20-03-14, 08:18 PM
hugox03 > 20-03-14, 11:30 PM
maidinhdan > 20-03-14, 11:32 PM
hugox03 > 21-03-14, 02:47 AM
maidinhdan > 21-03-14, 12:49 PM
(21-03-14, 02:47 AM)hugox03 Đã viết: File
https://www.mediafire.com/?644shdz245blj1j
bạn giúp mình chuyển sang word với !
Private Sub cmdXuat_Click()
Dim oApp As Object, doc As Object
Dim strDocName As String
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
strDocName = CurrentProject.Path & "\DataMauBH" & "\formMauhoadon.dot"
Set doc = oApp.Documents.Add(strDocName)
doc.FormFields("txttenkhachhang").Result = IIf(Me.TenKH.Value <> "", Me.TenKH, ".....")
doc.FormFields("txtdvct").Result = IIf(Me.Text65.Value <> "", Me.Text65, ".....")
doc.FormFields("Text1").Result = [Forms]![F_Banhang]![CTHD]![Text1]
doc.FormFields("Text2").Result = [Forms]![F_Banhang]![CTHD]![Text2]
doc.FormFields("Text3").Result = [Forms]![F_Banhang]![CTHD]![Text3]
doc.FormFields("Text4").Result = [Forms]![F_Banhang]![CTHD]![Text4]
doc.FormFields("Text5").Result = [Forms]![F_Banhang]![CTHD]![Text5]
doc.FormFields("Text6").Result = [Forms]![F_Banhang]![CTHD]![Text6]
doc.FormFields("Text7").Result = [Forms]![F_Banhang]![CTHD]![Text7]
oApp.ActiveDocument.SaveAs Filename:=CurrentProject.Path & "\" & Me.SoHD.Value & ".doc"
Set oApp = Nothing
MsgBox "Xuat data thanh cong"
End Sub
nhannt4 > 21-03-14, 02:35 PM
(21-03-14, 12:49 PM)maidinhdan Đã viết:(21-03-14, 02:47 AM)hugox03 Đã viết: File
https://www.mediafire.com/?644shdz245blj1j
bạn giúp mình chuyển sang word với !
Đã làm xong, Link của bạn đây: http://www.mediafire.com/download/4d26fr...N-QLBH.rar
Góp ý: sao không sử dụng report luôn. Vì Hóa đơn có gì đâu mà cần nối với word.
Code nút xuất[/code]
Mã:Private Sub cmdXuat_Click()
Dim oApp As Object, doc As Object
Dim strDocName As String
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
strDocName = CurrentProject.Path & "\DataMauBH" & "\formMauhoadon.dot"
Set doc = oApp.Documents.Add(strDocName)
doc.FormFields("txttenkhachhang").Result = IIf(Me.TenKH.Value <> "", Me.TenKH, ".....")
doc.FormFields("txtdvct").Result = IIf(Me.Text65.Value <> "", Me.Text65, ".....")
doc.FormFields("Text1").Result = [Forms]![F_Banhang]![CTHD]![Text1]
doc.FormFields("Text2").Result = [Forms]![F_Banhang]![CTHD]![Text2]
doc.FormFields("Text3").Result = [Forms]![F_Banhang]![CTHD]![Text3]
doc.FormFields("Text4").Result = [Forms]![F_Banhang]![CTHD]![Text4]
doc.FormFields("Text5").Result = [Forms]![F_Banhang]![CTHD]![Text5]
doc.FormFields("Text6").Result = [Forms]![F_Banhang]![CTHD]![Text6]
doc.FormFields("Text7").Result = [Forms]![F_Banhang]![CTHD]![Text7]
oApp.ActiveDocument.SaveAs Filename:=CurrentProject.Path & "\" & Me.SoHD.Value & ".doc"
Set oApp = Nothing
MsgBox "Xuat data thanh cong"
End Sub