To support this Thread
http://www.excelfox.com/forum/showth...0679#post10679
Re post code in Code tags, Like ....
Please use CODE TAGS if you are writing codes in your post.
To use code tags,
either
select your entire code and press the code tag button # in the editor below,
or
simply type your code as below
[Code]Your Code Here[/Code]
[Code]
Your Code Here
[/Code]
[Code]
Private Sub cmdNot_Click()
Dim OutApp As Object
Dim OutMail As Object
…………………….
……………..
End Sub
[/Code]
BBCodeCodeTags.JPG : https://imgur.com/4HunNcs
BBCodeCodeTags.JPG
_.__________________
If you post using Code tags, then it will come out in the final post in a Code Window, like this:
Code:Private Sub cmdNot_Click() Dim OutApp As Object Dim OutMail As Object Dim fileName As String Dim mSubject As String Dim signature As String Dim fname As String Dim mBody As String Dim rng As Range Dim rng1 As Range Dim ws As Worksheet Dim mailTo As String Set ws = Sheets("MRO") fname = ws.Range("B4") mSubject = "MRO " & " For " & Range("C6").Value Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) 'mBody = "2-SO\Material Request Form .xlsm" Dim Path As String mBody = "<font size=""3"" face=""Calibri"">" & _ "Dear Team,<br><br>" & _ "Please open the file from below link and put your signature on the respective cell after you completed your task.<br><B>" & _ fileName & ".xlsm" & "</B> is created.<br>" & _ "Click on this link to open the file : " & _ "<A HREF=""file://" & Path & fileName & ".xlsm" & _ """>Files are saved here</A>" & "-->" & Range("C6").Value & _ "<br><br>Best Regards," & _ "<br><br></font>" With OutMail .display End With signature = OutMail.body With Application .EnableEvents = False .ScreenUpdating = False End With With OutMail '.To = "email" .To = "" .CC = "" .BCC = "" .Subject = mSubject '.body = "Dear Team," & vbCrLf & vbCrLf & "Please open the file from below link and put your signature on the respective cell and save the sheet" '.htmlbody = RangetoHTML(rng) .htmlbody = mBody '.Attachments.Add fileName .display End With 'ws.PageSetup.RightHeader = "&""Calibri,italic""&11& " & ws.Range("A1") ActiveWorkbook.Close False ActiveWorkbook.Close On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing With Application .ScreenUpdating = True .EnableEvents = True End With




Reply With Quote
Bookmarks