BookmarkSubscribeRSS Feed
Abelp9
Quartz | Level 8

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.

 

ERROROUTLOOK.PNG

 

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

2 REPLIES 2
ballardw
Super User

If you haven't already, I suggest checking with a Microsoft VBA programming board. Your problem is not apparently SAS related but in the download from Outlook portion.

 

I found out with an earlier project that anything involving Outlook rules can be very fragile. Minor upgrades to Outlook and they stop working. Changes in settings by our IT staff and they quit working.

 

 

Abelp9
Quartz | Level 8

And is there something that does the same functions as the outlook rules?

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 556 views
  • 3 likes
  • 2 in conversation