Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Sub JunkFile() Dim outputFile As Object Dim objFSO As Object Dim recip As Recipient Const strFileSpec As String = "c:\Deleteme\JunkMail.txt" If Application.ActiveExplorer.Selection.Count <> 1 Then Exit Sub MsgBox " I am inside the app " On Error Resume Next Set objFSO = CreateObject("scripting.filesystemobject") Set outputFile = objFSO.opentextfile(strFileSpec, 8) On Error GoTo 0 If outputFile Is Nothing Then Set outputFile = objFSO.createtextfile(strFileSpec, True) ' Set outputFile = objFSO.createtextfile(strFileSpec, True) For Each recip In Application.ActiveExplorer.Selection(1).Recipients If recip.Type = olTo Then outputFile.Writeline recip.Address End If Next outputFile.Writeline "End of file" & " " & Now() outputFile.Close Set outputFile = Nothing MsgBox "end of processing " End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.