Edit as follows to reset lngCount before looping the messages...
...
For Each objMsg In objSelection
Set objAttachments = objMsg.Attachments
lngCount = 0 'reset
lngCount = objAttachments.Count
If lngCount 0 Then
For i = lngCount To 1 Step -1
strFile = objAttachments.Item(i).FileName
If Right(strFile, 3) = "pdf" Then
strFile = strFolderpath & strFile
objAttachments.Item(i).SaveAsFile strFile
'use ShellExecute to open the file
'this may not work with zip extension if you use
Compressed folders ShellExecute 0, "print", strFile,
vbNullString, vbNullString, 0 objMsg.FlagStatus =
olFlagComplete
End If
Next
End If
Next
ExitSub:
Set objAttachments = Nothing
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing
End Sub
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion