I have the following code that is not working. The streams variable is not receiving the values I'm trying to pass to it.
1 Sub INSERTSTOREDPROCESSWITHINPUTSTREAMS()
2 Dim sas As SASExcelAddIn
3 Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object
4 Dim streams As SASRanges
5 Set streams = sas.CreateSASRangesObject
6 streams.Add "ENTSAIDA", Worksheets("EntradaSaida").Range("A1:B13")
7 streams.Add "VARIAVEIS", Worksheets("Variaveis").Range("A1", "I7")
8 sas.InsertStoredProcess "/User Folders/antonaci(1)/My Folder/Credibilidade", Worksheets("Plan1").Range("A1"), , , streams
9 End Sub
First, the StoredProcesss is working properly. If I call it from the SAS Menu and select those ranges as input it works without a problem.
If I run the above code I get the following error from SAS:
136 +LIBNAME ENTSAIDA XML;
NOTE: Libref ENTSAIDA was successfully assigned as follows:
Engine: XML
Physical Name: ENTSAIDA
137 +DATA WORK.ENTRADASAIDA;
138 + SET ENTSAIDA.&_WEBIN_SASNAME;
ERROR: File ENTSAIDA.EXCEL_TABLE.DATA does not exist.
139 +RUN;
If I mark the VBA code to pause right before line 8 and check the streams variable, it is empty.
I also tried to use the following code in line 5, but I get the same results.
5 Set streams = New SASRanges
Also,
Worksheets("EntradaSaida").Range("A1:B13").Select
selects the range I want, so I'm sure I didn't misspelled the sheet name.
Does anyone have any idea what may be happening?
I'm using:
SAS Add-In for Microsoft Office 7.15 HF7 (7.100.5.6182)
Microsoft Excel 2013 (15.0.5059.1000)