กระทู้เก่าบอร์ด อ.Yeadram
881 5
URL.หัวข้อ /
URL
มันฟ้อง Error ตรงบรรทัดตัวหน่า
[SIZE=3][/FONT][SIZE=3]Private Sub Command113_Click()[/FONT]
Dim filenanme As String
Dim filepath As String
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
Dim rs As Recordset
Dim recipientList As String
On Error GoTo errhandler
FileName = Me.PURCHASE_ORDER & "_" & Me.MATERIAL_SLIP_NUMBER & "_" & Me.VENDOR_NAME & "_Wait" & Me.wait & " Day"
filepath = "C:\Users\Public\" & FileName & ".pdf"
DoCmd.OutputTo acOutputReport, "rptrequestorINVOICE", acFormatPDF, filepath
If oOutlook Is Nothing Then
Set oOutlook = New Outlook.Application
End If
Set oEmailItem = oOutlook.createItem(olmailItem)
With oEmailItem
.To = "[email protected]"
.Subject = " µÔ´µÒÁ Invoice ¤§¤éÒ§ PO: " & Me.PURCHASE_ORDER
.attachments.Add filepath
.Display
End With
exit_errhandler:
Exit Sub
Set oEmailItem = Nothing
Set oOutlook = Nothing
Kill filepath
errhandler
MsgBox Err.DESCRIPTION, vbExclamation
Resume Next
End Sub
Dim filenanme As String
Dim filepath As String
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
Dim rs As Recordset
Dim recipientList As String
On Error GoTo errhandler
FileName = Me.PURCHASE_ORDER & "_" & Me.MATERIAL_SLIP_NUMBER & "_" & Me.VENDOR_NAME & "_Wait" & Me.wait & " Day"
filepath = "C:\Users\Public\" & FileName & ".pdf"
DoCmd.OutputTo acOutputReport, "rptrequestorINVOICE", acFormatPDF, filepath
If oOutlook Is Nothing Then
Set oOutlook = New Outlook.Application
End If
Set oEmailItem = oOutlook.createItem(olmailItem)
With oEmailItem
.To = "[email protected]"
.Subject = " µÔ´µÒÁ Invoice ¤§¤éÒ§ PO: " & Me.PURCHASE_ORDER
.attachments.Add filepath
.Display
End With
exit_errhandler:
Exit Sub
Set oEmailItem = Nothing
Set oOutlook = Nothing
Kill filepath
errhandler
MsgBox Err.DESCRIPTION, vbExclamation
Resume Next
End Sub
5 Reply in this Topic. Dispaly 1 pages and you are on page number 1
2 @R22452
ไปที่ vba editor แล้วเลือก Tools - References - Microsoft Outlook x.xx Object Library ครับ
3 @R22453
พี่ สันติสุข มันขึ้นจางๆ ตรงปุ่ม References ครับพี่
4 @R22454
ลองปิดโปรแกรม แล้วเข้าใหม่ครับ (ไมโครซอฟท์บอกอย่างงั้น)
5 @R22463
ขอบคุรครับ หายแล้วครับ อาจารย์
Time: 0.2844s
รูปตัวอย่าง