1

I have used the code below on outlook 2010 without any glicthes but with 2016 outlook it does nothing and gives no error.

sub copylastsenttomem ()
 Dim objSentFolder As Outlook.MAPIFolder
 Dim objSentItem As Outlook.MailItem
Dim outForward As Outlook.MailItem
    Dim objNS As Namespace
Dim objFolder As MAPIFolder


Set objNS = GetNamespace("MAPI")
Set objFolder = objNS.GetDefaultFolder(olFolderSentMail)

  Set outForward = objFolder.Items(1).Forward
 'Set outForward = objFolder.Items(1)
'outForward.Display

 Dim M As MailItem, Buf As MSForms.DataObject
Set M = outForward


Set Buf = New MSForms.DataObject
Buf.SetText M.body
Buf.PutInClipboard


end sub
dsamorano
  • 11
  • 3

1 Answers1

1

In the code, you assume that the Sent Items folder has any items inside:

  Set objFolder = objNS.GetDefaultFolder(olFolderSentMail)
  Set outForward = objFolder.Items(1).Forward

Make sure that a folder contains at least one item to forward.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45