daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Sub MailPortalLink(strLink As String)
  2.     On Error GoTo ErrorHandler
  3.    
  4.     Dim oInspector As Lime.inspector
  5.     Dim oAddin As Object
  6.     Dim oNewMail As Object
  7.     Dim strBody As String
  8.     Dim strSubject As String
  9.        
  10.     Set oInspector = Application.ActiveInspector
  11.    
  12.     'Kontaktperson
  13.     If Globals.VerifyInspector("person", oInspector, True) Then
  14.    
  15.         'Find Addin
  16.         Set oAddin = Application.FindAddIn("LimeOutlookXP.Addin")
  17.        
  18.         If oAddin Is Nothing Then
  19.             Call Lime.MessageBox(Localize.GetText("addins", "e_mailaddinnotfound"), VBA.vbOKOnly Or VBA.vbError)
  20.             Exit Sub
  21.         End If
  22.        
  23.         'Subject
  24.         strSubject = Localize.GetText("GDPR", "t_mail_portal_link_subj")
  25.        
  26.         'Link
  27.         strLink = "<a href = """ & strLink & """>" & strLink & "</a>"
  28.        
  29.         'Body
  30.         strBody = strBody & "<html><body>"
  31.         strBody = strBody & Localize.GetText("GDPR", "t_mail_portal_link_body")
  32.         strBody = VBA.Replace(strBody, "{{name}}", oInspector.Record.Value("name"))
  33.         strBody = VBA.Replace(strBody, "{{url}}", strLink)
  34.         strBody = VBA.Replace(strBody, VBA.vbLf, "<br>")
  35.         strBody = strBody & "</body></html>"
  36.        
  37.         ' Create and open email
  38.         Set oNewMail = VBA.CreateObject("LimeOutlookXP.NewMail")
  39.         oNewMail.Recipients = oInspector.Record.Value("email")
  40.         oNewMail.Subject = strSubject
  41.         oNewMail.HTMLBody = strBody
  42.         oNewMail.Context = oInspector.Record
  43.         oNewMail.Display
  44.     End If
  45.  
  46.     'Part
  47.     If Globals.VerifyInspector("company", oInspector, True) Then
  48.    
  49.         'Find Addin
  50.         Set oAddin = Application.FindAddIn("LimeOutlookXP.Addin")
  51.        
  52.         If oAddin Is Nothing Then
  53.             Call Lime.MessageBox(Localize.GetText("addins", "e_mailaddinnotfound"), VBA.vbOKOnly Or VBA.vbError)
  54.             Exit Sub
  55.         End If
  56.        
  57.         'Subject
  58.         strSubject = Localize.GetText("GDPR", "t_mail_portal_link_subj")
  59.        
  60.         'Link
  61.         strLink = "<a href = """ & strLink & """>" & strLink & "</a>"
  62.        
  63.         'Body
  64.         strBody = strBody & "<html><body>"
  65.         strBody = strBody & Localize.GetText("GDPR", "t_mail_portal_link_body")
  66.         strBody = VBA.Replace(strBody, "{{name}}", oInspector.Record.Value("name"))
  67.         strBody = VBA.Replace(strBody, "{{url}}", strLink)
  68.         strBody = VBA.Replace(strBody, VBA.vbLf, "<br>")
  69.         strBody = strBody & "</body></html>"
  70.        
  71.         ' Create and open email
  72.         Set oNewMail = VBA.CreateObject("LimeOutlookXP.NewMail")
  73.         oNewMail.Recipients = oInspector.Record.Value("email")
  74.         oNewMail.Subject = strSubject
  75.         oNewMail.HTMLBody = strBody
  76.         oNewMail.Context = oInspector.Record
  77.         oNewMail.Display
  78.     End If
  79.    
  80.     'Installatör
  81.     If Globals.VerifyInspector("installer", oInspector, True) Then
  82.    
  83.         'Find Addin
  84.         Set oAddin = Application.FindAddIn("LimeOutlookXP.Addin")
  85.        
  86.         If oAddin Is Nothing Then
  87.             Call Lime.MessageBox(Localize.GetText("addins", "e_mailaddinnotfound"), VBA.vbOKOnly Or VBA.vbError)
  88.             Exit Sub
  89.         End If
  90.        
  91.         'Subject
  92.         strSubject = Localize.GetText("GDPR", "t_mail_portal_link_subj")
  93.        
  94.         'Link
  95.         strLink = "<a href = """ & strLink & """>" & strLink & "</a>"
  96.        
  97.         'Body
  98.         strBody = strBody & "<html><body>"
  99.         strBody = strBody & Localize.GetText("GDPR", "t_mail_portal_link_body")
  100.         strBody = VBA.Replace(strBody, "{{name}}", oInspector.Record.Value("name"))
  101.         strBody = VBA.Replace(strBody, "{{url}}", strLink)
  102.         strBody = VBA.Replace(strBody, VBA.vbLf, "<br>")
  103.         strBody = strBody & "</body></html>"
  104.        
  105.         ' Create and open email
  106.         Set oNewMail = VBA.CreateObject("LimeOutlookXP.NewMail")
  107.         oNewMail.Recipients = oInspector.Record.Value("email")
  108.         oNewMail.Subject = strSubject
  109.         oNewMail.HTMLBody = strBody
  110.         oNewMail.Context = oInspector.Record
  111.         oNewMail.Display
  112.     End If
  113.    
  114.     'Fastighetsägare
  115.     If Globals.VerifyInspector("property_owner", oInspector, True) Then
  116.    
  117.         'Find Addin
  118.         Set oAddin = Application.FindAddIn("LimeOutlookXP.Addin")
  119.        
  120.         If oAddin Is Nothing Then
  121.             Call Lime.MessageBox(Localize.GetText("addins", "e_mailaddinnotfound"), VBA.vbOKOnly Or VBA.vbError)
  122.             Exit Sub
  123.         End If
  124.        
  125.         'Subject
  126.         strSubject = Localize.GetText("GDPR", "t_mail_portal_link_subj")
  127.        
  128.         'Link
  129.         strLink = "<a href = """ & strLink & """>" & strLink & "</a>"
  130.        
  131.         'Body
  132.         strBody = strBody & "<html><body>"
  133.         strBody = strBody & Localize.GetText("GDPR", "t_mail_portal_link_body")
  134.         strBody = VBA.Replace(strBody, "{{name}}", oInspector.Record.Value("name"))
  135.         strBody = VBA.Replace(strBody, "{{url}}", strLink)
  136.         strBody = VBA.Replace(strBody, VBA.vbLf, "<br>")
  137.         strBody = strBody & "</body></html>"
  138.        
  139.         ' Create and open email
  140.         Set oNewMail = VBA.CreateObject("LimeOutlookXP.NewMail")
  141.         oNewMail.Recipients = oInspector.Record.Value("email")
  142.         oNewMail.Subject = strSubject
  143.         oNewMail.HTMLBody = strBody
  144.         oNewMail.Context = oInspector.Record
  145.         oNewMail.Display
  146.     End If
  147.    
  148.     Exit Sub
  149. ErrorHandler:
  150.     Call UI.ShowError("GDPR.MailPortalLink")
  151. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top