So, I followed your advice and went to the Help in the SAS AddIn Section in XL.
Then I tried to follow the instructions indicated in the Help section. I followed the instructions (instructions detailled under) and copied the code mentionned here under and got the message
"compile error - only valid in object module"
Managing SAS Content Writing event procedures in Excel
To write an event procedure in Excel, follow these steps:
Select Tools Macro Visual Basic Editor. The Microsoft Visual Basic Editor opens.
In the Visual Basic Editor, select Tools References. The References dialog box opens.
From the list, select SAS.OfficeAddin and click OK. In the Project pane, double-click the class module for the existing workbook.
In the code module for the workbook, insert the following code:
Private WithEvents sas As SASAddIn
Private Sub Workbook_Open()
Set sas = Application.COMAddIns.Item("SAS.OfficeAddin.Loader.ConnectProxy").object
Private Sub sas_ItemUpdated(ByVal refreshableObject As Variant)
MsgBox "SAS item has been updated: " + refreshableObject
The object name of the job is returned by the refreshableObject parameter of the ItemUpdated event. You can use this information to identify what job was refreshed. In Excel, the object name is the name of the range that contains the entire results from the job. To view the object name for a job, see the Object name field on the General tab of the Properties dialog box.
Select File Close and Return to Microsoft Excel.
To execute this code after you have inserted it, save the file and close Excel. The next time that you open the workbook this code is automatically executed.
It is odd if "SAS_OfficeAddin" isn't in the list. You may want to look at the top of the list as well since I noticed not all the items are alphabetized.
If you can't find it, you can run that macro without adding a reference to "SAS_OfficeAddin" by removing or commenting out the "As SASAddin" by placing a single quote in front of it like so:
Dim SasAddinObj 'As SASAddin
This may require you turning off options explicit.
That VBA macro is not interactive -- it doesn't show any UI. It simply refreshes one or more pieces of content (data views, PivotTables, reports, stored processes). To verify that it actually refreshed, you can either change values in the source data or delete some of the values in the results in the worksheet, then run the macro and ensure the latest values are retrieved (Excel doesn't allow you to delete values in a PivotTable, so you'd have to change the source data to verify it).