Hello, first of all I don't know if this is the right place to post this, but I can't find another place (if you send it to me I'll be grateful).
It turns out that I am trying to automate a process in SAS and the beginning of this process is when I receive 4 emails with 1 attached file each and I have to download them and change the delimiter and then put them in a SAS flow, so far so good, the The problem is when automatically downloading the Outlook files, these emails seem to have to arrive slowly because an error appears but randomly (the error that I show in the image below), that is, always He sent me 4 files and sometimes the error appears in the first one, others in 2, others in 3... and they use the same script, so I don't understand this randomness when it comes to getting the error.
The translation basically is: the error x has occurred at runtime. Attachments cannot be saved. Check that the path and name are correct
Here I also leave the vba code that I used to download the attached files.
Public Sub prueba(item As Outlook.MailItem)
Dim object_attachment As Outlook.Attachment
Dim saveFolder As String
saveFolder = "J:\xxx\xx\xxx\xx\xx\xx\xxxxx\"
For Each object_attachment In item.Attachments
If InStr(object_attachment.FileName, ".csv") Then
'If Int(object_attachment.ReceivedTime) = Date Then
object_attachment.SaveAsFile saveFolder & "\" & object_attachment.FileName
End If
'End If
Next
End Sub
It should be noted that the outlook rule leaves the files in a folder that is visible on the SAS server and acts as a "bridge" between windows and SAS. I download the files in this specific folder to "automate" the upload of the file to SAS from windows. If anyone can think of a better way to do this I'd be very grateful too.
Has anyone else faced this and solved it? Thank you very much in advance, best regards