If you want to mark all mails as read in your outlook Inbox.
Here is the code -
Sub mark_all_unread_mails_as_read_in_inbox_excluding_subfolders()
'TOOLS ->Refrence -> microsoft outlook
'declare outlook objects
Dim olapp As Outlook.Application
Dim olappns As Outlook.Namespace
Dim oinbox As Outlook.Folder
Dim oitem As Outlook.MailItem
'set outlook objects
Set olapp = New Outlook.Application
Set olappns = olapp.GetNamespace("MAPI")
Set oinbox = olappns.GetDefaultFolder(olFolderInbox)
If oinbox.Items.Restrict("[UnRead] = True").Count = 0 Then
MsgBox "NO Unread Email In Inbox"
Exit Sub
End If
Do Until oinbox.Items.Restrict("[UnRead] = True").Count = 0
For Each oitem In oinbox.Items.Restrict("[UnRead] = True")
oitem.UnRead = False
Next
Loop
End Sub
Subscribe to:
Post Comments (Atom)
Import data from SQL
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
-
If you want to add a new menu on mouse right click "Workbook Navigation showing you the list of all open workbooks and worksheets in ea...
-
Macro to Export Range in Json Format Option Explicit Sub export_in_json_format() Dim fs As Object Dim jsonfile Dim rangetoex...
No comments:
Post a Comment