BookmarkSubscribeRSS Feed
Abelp9
Quartz | Level 8

Hello everyone, I am trying to create a program to automatically download the attached files that are sent to us from a certain email and then transform the delimiter with SAS, of those csv that are attached to us and pass those csv through a flow that I have already created.

 

I have managed to create a program that treats the csv as I want and the delimiter that I want, the problem is that when it comes to automating the download of files from Outlook it does not work.

 

What I have done is create a rule with the following VB code that I found on the internet:

 

Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "C:\Users\DT168\Documents\outlook-attachments\"
For Each oAttachment In MItem.Attachments
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
Next
End Sub

 

website: https://es.extendoffice.com/documents/outlook/3747-outlook

 

The problem is that this code does not work for me, it does absolutely nothing for me and no matter how much I search the internet, only this code appears.

 

Is there any other way to do with SAS what I want? What is it to automatically download 8 csv files sent to me by Outlook, or has someone experienced the same thing as me with VBA?


I have followed all the steps about 7 times so I think the error is not in copying the code or selecting certain options wrong, in fact I had copied and pasted the code and later I modified the path where I wanted those to be saved. files but it doesn't work, does anyone know why?


I will be tremendously grateful, thank you very much for everything!

2 REPLIES 2
CarmineVerrell
SAS Employee
Hi, i have worked with VB and SAS in different ways. Unfortunately, i have never tried what you are trying to do but found a good video you can review below. One suggestion if you have not used it , is making sure to debug your code to see what is not working properly.

Hope this helps.
https://www.youtube.com/watch?v=ZXLyT6gqQp4


ballardw
Super User

Does your SAS LOG show any messages? If SAS is not actually getting something then this would be a WINDOWS question and not SAS.

 

 

I suggest that you contact your IT department. There have been several times that I wanted to link SAS and Outlook for some tasks but have found out that one or more of the pieces needed had been locked out by our IT for security reasons.

That could be one reason why your approach didn't work. If so, you might be able to get exceptions or suggestions from IT on implementation.

It may not hurt to get your management involved to demonstrate potential time savings or process improvements that would result with this automation so there is some support.

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 790 views
  • 2 likes
  • 3 in conversation