Outlook Mail send Code

Outlook mail send code

Below code copy and paste module
click here for download file:-    Outlook send mail file
_______________________________________________

Sub Send_Mail()

Dim outlookobj As Outlook.Application
Dim mitem As Outlook.MailItem
Set outlookobj = New Outlook.Application
Set mitem = outlookobj.CreateItem(olMailItem)
With mitem

.To = "nppsnee@gmail.com"
.Subject = "this is testing"
.Body = "this is computer outlook mail"
.Display
End With

End Sub
__________________________________________________

How to create right click commnad bar in excel


Paste code in thisworkbook(vba code) in excel file

For click example file download:-  click here  Right click commandbar file download

Note after code paste file save in macro xlsm format and open again 

Copy below code
__________________________________________________________

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Contextmenu As CommandBar
Set Contextmenu = Application.CommandBars("Cell")
For Each ctrl In Contextmenu.Controls
If ctrl.Tag = "my_cell_control_tag" Then
ctrl.Delete
End If
Next ctrl
End Sub

Private Sub Workbook_Open()
Dim Contextmenu As CommandBar
Set Contextmenu = Application.CommandBars("Cell")
With Contextmenu.Controls.Add(Type:=msoControlButton, before:=1)
.OnAction = "'" & ThisWorkbook.Name & "'!hello"         ' hello is macro name
.FaceId = 351
.Caption = "hello"
.Tag = "my_cell_control_tag"
End With
End Sub
____________________________________________________________

and Create  a  hello name  macro in  module

Sub hello()
MsgBox "hello nitin world"

End Sub



About Me

author Click here for Connect FB

Click here for Linkedin

Related Post No.

Powered by Blogger.

Contact Form

Name

Email *

Message *

Search This Blog

Recent Posts

Breaking

Recent Posts

Trending Topic

Breaking

Related Post No.

Pages