Error MSOUTL.OLB รุ่น 9.5. เปิดด้วย Access Runtime2007

เริ่มโดย paitoon, 30 พ.ย 20 , 14:15:50

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

paitoon



ขออนุญาตสอบถามครับ ผมเขียนโปรแกรม แบบมีการส่งเมล์
เครื่องที่เปิดด้วย Access Runtime2007 จะมี Error MSOUTL.OLB รุ่น 9.5.  แต่เครื่องผมเองไม่มี Error ใช้ Microsoft Office Access 2007
ผมแก้ไขอย่างไรดีครับ ขอคำแนะนำด้วยครับ

Private Sub Command511_Click()
'Save -------------------------------
Dim FileName As String
Dim FilePath As String
       FileName = "เอกสารเข้าออกพื้นที่"
       FilePath = "C:\CJ\" & FileName & ".pdf"
       DoCmd.OutputTo acOutputReport, "rN_app_re_admin1", acFormatPDF, FilePath
       'End If
'Mail -------------------------------
Dim oApp As New Outlook.Application
Dim oEmail As Outlook.MailItem
Set oEmail = oApp.CreateItem(olMailItem)
Set oEmail = oApp.CreateItem(olMailItem)
oEmail.To = Me.mail
oEmail.SUBJECT = "เอกสารเข้าออกพื้นที่"
oEmail.Attachments.Add "C:\CJ\" & FileName & ".pdf"
    With oEmail
    If Not IsNull(.To) And Not IsNull(.SUBJECT) And Not IsNull(.Body) Then
    .Send
     Else
     End If
    End With
MsgBox ("บันทึกเรียบร้อยแล้ว"), vbInformation
End Sub

ขอบคุณครับ
  •  

PNR

#1
  ขั้นแรก ลองลบ office แล้วลงใหม่ดูก่อน
  ถ้าไม่หายลองปรับโค้ดเป็นแบบนี้ Backup ก่อนนะครับ
  วิธีใช้การเปลี่ยนตัวแปร
เปลี่ยนจาก  Dim olApp As Outlook.Application
เป็น  Dim olApp As Object

Dim olApp As Object
  Dim olMail As Object
  Const olMailItem As Long = 0

  Set olApp = CreateObject("Outlook.Application")
  Set olMail = olApp.CreateItem(olMailItem)

  olMail.To = Me.mail
  olMail.Subject = "เอกสารเข้าออกพื้นที่"
  olEmail.Attachments.Add "C:\CJ\" & FileName & ".pdf"
  olMail.Body = "Body ของ Email"   

    If Not IsNull(olEmail.To) And Not IsNull(olEmail.SUBJECT) And Not IsNull(olEmail.Body) Then
    olEmail.Send
     Else
     End If

MsgBox ("บันทึกเรียบร้อยแล้ว"), vbInformation


Set oEmail = oApp.CreateItem(olMailItem)
Set oEmail = oApp.CreateItem(olMailItem)

ทำไมมันซ้ำ
Time to stop for me  :dizzy:
  •  
    โพสต์นี้ได้รับคำขอบคุณจาก: paitoon

paitoon

ขอบคุณครับผม เดียวผมลองปรับแก้ตามคำแนะนำครับ เดียวแจ้งให้ทราบว่าผลออกมาอย่างไรครับ  ขอบคุณมากเลยครับ
  •  

paitoon



ผมเอาโค๊ด ลองปรับมาทำดู มี error ตามภาพด้านบน ต้องปรับแก้ไขอย่างไรดีครับ   ขอบคุณครับ

  •  

PNR

แปปนะครับ ผมลองทดสอบแปป
Time to stop for me  :dizzy:
  •  
    โพสต์นี้ได้รับคำขอบคุณจาก: paitoon

paitoon

ผมแก้ไขได้แล้วครับ โดยโหลดตัว MSOUTL.OLB ไปวาง Program Files (x86)Microsoft Office2007Office12

ขอบคุณครับ
  •  
    โพสต์นี้ได้รับคำขอบคุณจาก: PNR