PDA

View Full Version : SAS Manage Content Refresh via Windows Task Scheduler



Truelie
2016-04-13, 06:50 AM
Hi,

I am having the excel workbooks embedded with the SAS Datasets using the SAS Addin.

Currently, I'm manually opening the Excel report which is embedded with SAS Datasets and in the menu bar

SAS - > Manage Content -> Refresh

It will refresh all the datasets inside the workbook.

Am trying to automate this process using VBA and it is working fine when i was running it via Visual Basic Editor.

But whenever i schedule this process, the VBA fails by throwing the Error message in the below line of code,

Sub Test()
Dim WB As Workbook
Dim SAS As SASExcelAddIn
Dim SName As String

Application.ScreenUpdating = False
' To Refresh the SAS Datasets attached in excel
Set SAS = ThisWorkbook.Application.COMAddIns.Item("SAS.ExcelAddIn").Object
SAS.Refresh

End Sub