maxx_daddy
Board Regular
- Joined
- Dec 3, 2010
- Messages
- 74
Code:
For Each objAtt In itm.Attachments If InStr(1, objAtt.DisplayName, ".jpg") > 0 Then '<-- will save if this is gone
stFilename = saveFolder & "\" & itm.Subject & "-" & dateFormat & ".JPG"
i = 0
Do While Dir(stFilename) <> ""
i = i + 1
stFilename = saveFolder & "\" & i & "-" & itm.Subject & "-" & dateFormat & "-" & ".jpg"
Loop
objAtt.SaveAsFile stFilename
Set objAtt = Nothing
End If '<-- will save if this is gone
Next
If I get rid of the If InStr and the last end if it saves all the attachments, leading me to believe I have written it wrong.
What did I do wrong? (note this code is in outlook VBA but it all works the same in my experience)
Trying to save all "jpg" files