Làm sao bôi đỏ được 1 chữ ".body" trong Mail Outlook (1 người xem)

Liên hệ QC

Người dùng đang xem chủ đề này

Tường_Vi

Thành viên tiêu biểu
Tham gia
19/4/10
Bài viết
482
Được thích
121
Nghề nghiệp
Luôn tìm kiếm một vị trí tốt hơn
Em có thủ tục sau
PHP:
Sub EmailWithOutlook()   
Dim oApp As Object   
Dim oMail As Object    
Dim thanmen As String       
Application.ScreenUpdating = False
Set oApp = CreateObject("Outlook.Application")    
Set oMail = oApp.CreateItem(0)    
With oMail            
' mail adress         
'.To =          
'subject mail        
' .Subject =        
 '.Attachments.Add   'WB.FullName                  
.body = "" & _         
"Pls copy / forward this email to Acc-dept or to whom it may concern " & Chr(13) & _         
"Thanks for your support" & Chr(13) & _  
 "-----------------------------------------" & Chr(13) & _     
"Dear "  & Chr(13) & _         
"Cc: /Acc Dept" & Chr(13) & _         
"Pls check and confirm by return to acknowlegde receipt of DEBITs." & Chr(13) & _         "" & Chr(13) & _         
"***NOTE***" & Chr(13) & _   
"ACCEPT NO CANCELLATION INVOICE if the DEBITs are not yet confirmed within 03 days excluded Sat-Sun" & Chr(13) & _  
 .Display  ' de hien thi email outlook, ko co chu nay email qua'i hien thi   
 End With
Application.ScreenUpdating = True    
Set oMail = Nothing    
Set oApp = Nothing
End Sub

Chạy thủ tục trên sẽ gọi mail mới có nội dung như sau
Pls copy / forward this email toAcc-dept or to whom it may concern
Thanks for your support
-----------------------------------------
Dear
Cc: /Acc Dept
Pls check and confirm by return toacknowlegde receipt of DEBITs.


***NOTE***

ACCEPT NO CANCELLATION INVOICE ifthe DEBITs are not yet confirmed within 03 days excluded Sat-Sun

Làm sao em bôi đỏ & đậm được chữ

ACCEPT NO CANCELLATION INVOICE if the DEBITs are not yet confirmed within 03 days excluded Sat-Sun



 
Lần chỉnh sửa cuối:
Em có sưu tầm bài viết này nhưng cũng chưa giải quyết được
PHP:
 								Changing font in Outlook 							 							 							
							I have code from excel to create an  email and copy data to the email.  The information copied over always  goes to times new roman, and I need it to be in Calibri 11.  Appreciate  any help I can get, thanks.

Sub Mail_Outlook_With_Signature_Html()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String
    Dim SigString As String
    Dim Signature As String


    If Range("a2") = Empty Then
    MsgBox "Select Service and try again."
    Exit Sub
    End If
    
    If Range("b2") = Empty Then
    MsgBox "Select Issue and try again."
    Exit Sub
    End If
    
    If Range("a5") = Empty Then
    MsgBox "Select Calls in Queue and try again."
    Exit Sub
    End If
    
    
    If Range("b5") = Empty Then
    MsgBox "Select Minutes and try again."
    Exit Sub
    End If
    
    
    If Range("a8") = Empty Then
    MsgBox "Select Number of Agents or Managers and try again."
    Exit Sub
    End If
    
    
    If Range("b8") = Empty Then
    MsgBox "Select Status and try again."
    Exit Sub
    End If
    
    If Range("h2") = Empty Then
    MsgBox "Select Cause and try again."
    Exit Sub
    End If
             
    MsgBox "Please review the body of your email before you send."
          
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    
    
        
        SigString = Environ("appdata") & _
     "\Microsoft\Signatures\Santander.htm"

    If Dir(SigString) <> "" Then
        Signature = GetBoiler(SigString)
    Else
        Signature = ""
    End If

    On Error Resume Next
    
    
    With OutMail
             
        .To = Sheets("Communications").Range("a17")
        .CC = "my team"
        .BCC = ""
        .Subject = Sheets("Communications").Range("a20")
        .HTMLBody = Sheets("Communications").Range("a25") & Signature
        .Display
    End With
    
      
    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub
 

							Hitesh Patel 							  							16-Oct-2012  20:42 						 					 				 			 						 							 							 						 						 							niton 							   								18-Oct-2012  19:08 							   							 							 							 							
							See http://www.outlookcode.com/article.aspx?id=31

With the method below it appears Calibri size 11 is not avaialable.

Sub font()
' http://answers.microsoft.com/en-us/office/forum/office_2003-excel/vba-how-to-change-font-color-etc-in-an-email/67d1201f-806b-e011-8dfc-68b599b31bf5?msgId=e7029559-876b-e011-8dfc-68b599b31bf5
    
    Dim msg As Outlook.MailItem
    Dim mesgBody As String
    
    Set msg = Application.CreateItem(olMailItem)
    msg.Subject = "Font"
    
    mesgBody  = mesgBody & "<p><font face=""Calibri"" size=""3""  color=""red""><b>Please let me know if you have any  questions.</b></font></p><p></p>"
    mesgBody  = mesgBody & "<p><font face=""Calibri"" size=""2""  color=""blue""><i>Thanks and have a great  week!</i></font></p>"
    mesgBody = mesgBody &  "<p><font face=""Calibri"" size=""1""  color=""green""><u>SW</u></font></p>"

    msg.HTMLBody = mesgBody
  
    msg.Display
    Set msg = Nothing

End Sub
 
Upvote 0
Trang này hỗ trợ khá nhiều về VBA + Outlook

http://www.slipstick.com/outlook-developer/word-macro-apply-formatting-outlook-email/
A user in the Microsoft Answers forum wanted to know how to use a Word macro to apply formatting to selected text in Outlook 2010.
Outlook does not (and never had) a macro recorder but you can use some VBA code that was recorded in Word, in Outlook macros provided you reference the Word object model. You'll need to set the reference in the VB Editor's Tools, References menu. You'll also need to have macro security set to low or or sign the macro with a certificate to use it.
See How to use Outlook’s VBA Editor for help using the editor, setting security levels, and signing macros.

I tested this macro in Outlook 2010; it should also work in Outlook 2007.


Format Selected Text Macro

To use, open the VBA Editor (Alt+F11) and paste the code into a module. Select a block of text while composing a message and run the macro.

PHP:
Public Sub FormatSelectedText()
    Dim objItem As Object
    Dim objInsp As Outlook.Inspector
    
    ' Add reference to Word library
    ' in VBA Editor, Tools, References
    Dim objWord As Word.Application
    Dim objDoc As Word.Document
    Dim objSel As Word.Selection
    On Error Resume Next
   
'Reference the current Outlook item
    Set objItem = Application.ActiveInspector.currentItem
    If Not objItem Is Nothing Then
        If objItem.Class = olMail Then
            Set objInsp = objItem.GetInspector
            If objInsp.EditorType = olEditorWord Then
                Set objDoc = objInsp.WordEditor
                Set objWord = objDoc.Application
                Set objSel = objWord.Selection
     
       With objSel
       ' Formatting code goes here
            .Font.Color = wdColorBlue
            .Font.Size = 18
            .Font.Bold = True
            .Font.Italic = True
            .Font.Name = "Arial"
       End With
 
            End If
        End If
    End If
    
    Set objItem = Nothing
    Set objWord = Nothing
    Set objSel = Nothing
    Set objInsp = Nothing
End Sub
 
Lần chỉnh sửa cuối:
Upvote 0
Web KT

Bài viết mới nhất

Back
Top Bottom