09-09-2011 07:41 AM
I'm looking at using Access as an office automation tool for managing regular reports, Access not being used to hold transaction data but data to do with the reports themselves. We use it to log and manage the requests for data and reports coming into the area.
We run SAS EG 4.1 still (along with a host of other studff compared with which 4.1 is a spring chicken) with SAS on a Unix box. Some of the directories there are mapped to the Windows LAN so the idea as a first stage semi-automation is in the first instance for the Access application to write a parameter text file from which the SAS program can read the parameters and populate its macro variables before getting to the meat of the SAS. It works well and is pretty simple but we still need to open the SAS code in SAS EG, submit the job, wait for it to finish and then exit from SAS.
We have the MS Office Add-in for Office and from Excel I can read the SAS tables on the server in Excel etc but when I try to run sample code such as Chris's
it bombs out on the CreateObject line with an ActiveX error, with 4.1 or just 4 as the version number making no difference.
I've seen various specifications regarding what references one must configure to invoke a SAS.
This one is about the minimum but copying what it specifies makes no difference
Using ActiveX2.8 doesn't help and going in and selecting all the SAS the SAS references that dialog box offers does not help either, i.e. as per this example
Any pointers to the missing link would be greatly appreciated.
09-09-2011 08:31 AM
In EG 4.1, the automation model is a bit different. The complete reference information is at:
(There is a CHM file in the ZIP archive. Extract it, then right-click, select Properties, and "unblock" it - else you won't be able to view the content...)
Here is an example VB Script:
Dim prjName Dim prjObject Dim app prjName = "C:\EG 4.1 projects\mailinghtml.egp" 'Project Name Set app = CreateObject("SASEGObjectModel.Application.4") Set prjObject = app.Open(prjName,"") prjObject.Run ' Save the new project results prjObject.Save prjObject.Close app.Quit
First try to create a standalone VBS file and confirm that it runs with cscript.exe or wscript.exe. If it does, then the equivalent script in VBA should work as well.
09-10-2011 03:42 AM
VBS first was a good suggestion as the error still occurred with "SASEGObjectModel.Application.4" but the dialog was a bit more informative: Error code 800A01AD. Googling that lead me to searching the registry (its Windows XP Professional at work) and there is no occurrence of "SASEG", let alone that string followed by anything else. There are a few entries commencing with "SAS.EG*" and "SASObjectManager" though. Is there a DLL which needs to be on the machine to support the object model? If there is but it is not there that would be indicative of the need to look elsewhere, or just manually run SASEG and click on the run icon.