Disappeared Script. Plz Help

B

BlackScholes

I have a VBA script which ripes off attachment and save it onto local file
system. The script works fine usually. However it tends to disappear every
now and then randomly, which in turns cause the message rule to fail. Anyone
knows what might be the cause? Any help is appreciated.

The script i use is as follows:
Public Sub doImport(Item As Outlook.MailItem)
Dim iCtr As Integer
Dim sPathName

sPathName = "p:\onlineorder\import\pending\"
With Item.Attachments
iAttachCnt = .Count
If iAttachCnt > 0 Then
For iCtr = 1 To iAttachCnt
.Item(iCtr).SaveAsFile sPathName & .Item(iCtr).FileName
Next iCtr
End If
End With

DoEvents

SaveAttachments = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top