اذهب الي المحتوي
أوفيسنا

مساعده في كود فتح برنامج الاوتلوك عند الضغط على بريد الزبون


Radwan0
إذهب إلى أفضل إجابة Solved by سامي الحداد,

الردود الموصى بها

السلام عليكم اخواني

في نموذج tbl عند الضغط مرتين على حقل البريد فانه يقوم بفتح برنامج الاوتلوك 

الى الان الكود يعمل بشكل سليم لكن حصلت عندي مشكلتين

1) في حال كان حقل الايميل فارغ تظهر لي رسالة خطأ . كيف بالامكان اظهار رسالة تفيد بانه يجب ادخال بريد الكتروني او لا الكود لا يستجيب بفتح الماكرو او الاوتلوك

2) كيف بالامكان جعل نوع الخط ثابت والرسالة تبدا من اليمين وليس من الشمال

 

Option Compare Database

Private Sub mail_DblClick(Cancel As Integer)
    Dim Msg As String
    Msg = " hey " & namecus & "<p>"
    
   
  Dim O As Outlook.Application
  Dim M As Outlook.MailItem
  
  Set O = New Outlook.Application
  Set M = O.CreateItem(olMailItem)
  
  With M
    .BodyFormat = olFormatHTML
    .HTMLBody = Msg
    '.Body = txt - if you see olformatplain
    .To = mail
    '.CC="khate9191@gmail.com;khateb91@outlook.com"
    '.BCC="hateeb991@gmail.com"
    .Subject = " new mail " & Now()
    .Display
    '.send
   End With
    Set M = Nothing
    Set O = Nothing
End Sub

 

Database1.accdb

رابط هذا التعليق
شارك

وعليكم السلام 

تفضل اخي جرب الكود واعلمني بالنتيجة لانني لا استخدم الاوتلوك.

Private Sub mail_DblClick(Cancel As Integer)
 Dim Msg As String
    
    If Len(Mail) = 0 Then
        MsgBox "حقل البريد الإلكتروني فارغ. الرجاء إدخال عنوان البريد الإلكتروني "
        Exit Sub
    End If
    
    Msg = "<div style='direction:rtl; font-family:Consolas, Courier;'>" & _
          " hey " & namecus & "<br>" & _
          "</div>"
    
    Dim O As Outlook.Application
    Dim M As Outlook.MailItem
  
    Set O = New Outlook.Application
    Set M = O.CreateItem(olMailItem)
  
    With M
        .BodyFormat = olFormatHTML
        .HTMLBody = Msg
        '.Body = txt - if you see olformatplain
        .To = Mail
        '.CC="khate9191@gmail.com;khateb91@outlook.com"
        '.BCC="hateeb991@gmail.com"
        .Subject = " new mail " & Now()
        .Display
       '.send
    End With
    
    Set M = Nothing
    Set O = Nothing
End Sub

تحياتي

رابط هذا التعليق
شارك

  • أفضل إجابة

جرب هذا التعديل و وافنا بالنتيجة

Private Sub mail_DblClick(Cancel As Integer)
    Dim Msg As String
    
    If IsNull(Mail) Or Len(Mail) = 0 Then
        MsgBox "حقل البريد الإلكتروني فارغ. الرجاء إدخال عنوان البريد الإلكتروني "
        Exit Sub
    End If
    
    Msg = "<div style='direction:rtl; font-family:Consolas, Courier;'>" & _
          " hey " & namecus & "<br>" & _
          "</div>"
    
    Dim O As Outlook.Application
    Dim M As Outlook.MailItem
  
    Set O = New Outlook.Application
    Set M = O.CreateItem(olMailItem)
  
    With M
        .BodyFormat = olFormatHTML
        .HTMLBody = Msg
        '.Body = txt - if you see olformatplain
        .To = Mail
        '.CC="khate9191@gmail.com;khateb91@outlook.com"
        '.BCC="hateeb991@gmail.com"
        .Subject = " new mail " & Now()
        .Display
       '.send
    End With
    
    Set M = Nothing
    Set O = Nothing
End Sub

تحياتي

  • Like 1
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information