Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2012
2,983
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. 'Adds a link to the currently selected message to the clipboard
  3. Sub AddLinkToMessageInClipboard()
  4.     Dim objMail As Object
  5.     'was earlier Outlook.MailItem
  6.    Dim doClipboard As New DataObject
  7.     Dim message As String
  8.      
  9.     'One and ONLY one message muse be selected
  10.    If Application.ActiveExplorer.Selection.Count <> 1 Then
  11.         MsgBox ("Select one and ONLY one message.")
  12.         Exit Sub
  13.     End If
  14.    
  15.     Set objMail = Application.ActiveExplorer.Selection.Item(1)
  16.    
  17.     If objMail.Class = olMail Then
  18.         doClipboard.SetText "[[outlook:" + objMail.EntryID + "][MESSAGE: " + objMail.Subject + " (" + objMail.SenderName + ")]]"
  19.     ElseIf objMail.Class = olAppointment Then
  20.         doClipboard.SetText "[[outlook:" + objMail.EntryID + "][MEETING: " + objMail.Subject + " (" + objMail.Organizer + ")]]"
  21.     ElseIf objMail.Class = olTask Then
  22.         doClipboard.SetText "[[outlook:" + objMail.EntryID + "][TASK: " + objMail.Subject + " (" + objMail.Owner + ")]]"
  23.     ElseIf objMail.Class = olContact Then
  24.         doClipboard.SetText "[[outlook:" + objMail.EntryID + "][CONTACT: " + objMail.Subject + " (" + objMail.FullName + ")]]"
  25.     ElseIf objMail.Class = olJournal Then
  26.         doClipboard.SetText "[[outlook:" + objMail.EntryID + "][JOURNAL: " + objMail.Subject + " (" + objMail.Type + ")]]"
  27.     ElseIf objMail.Class = olNote Then
  28.         doClipboard.SetText "[[outlook:" + objMail.EntryID + "][NOTE: " + objMail.Subject + " (" + " " + ")]]"
  29.     Else
  30.         doClipboard.SetText "[[outlook:" + objMail.EntryID + "][ITEM: " + objMail.Subject + " (" + objMail.MessageClass + ")]]"
  31.     End If
  32.    
  33.     doClipboard.PutInClipboard
  34.    
  35. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement