如何在 Excel 中键入 SAS 提示值以运行存储过程? [英] How to type SAS prompt value in Excel to run stored process?

查看:23
本文介绍了如何在 Excel 中键入 SAS 提示值以运行存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 VBA 的经验非常有限.以下 VBA 代码运行 SAS 存储过程并将结果放入 Excel 电子表格.存储过程提示EUID"设置为返回值 5555.如何修改代码,以便从电子表格中的单元格(例如单元格 B1)中提取提示的值,而不是在代码中定义?我希望最终用户能够在单元格中输入 EUID 值,按下按钮运行宏,然后返回数据集.谢谢您的帮助.

My experience with VBA is very limited. The following VBA code runs a SAS stored process and places the results in an Excel spreadsheet. The stored process prompt "EUID" is set to return the value of 5555. How do I revise the code so that the value of the prompt is pulled from a cell in the spreadsheet (e.g. cell B1), rather than being defined in the code? I want the end user to be able to type the EUID value in a cell, press a button to run the macro, and return the data set. Thank you for your help.

Sub InsertStoredProcessWithPrompts()
Dim sas As SASExcelAddIn
Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object
Dim prompts As SASPrompts
Set prompts = New SASPrompts
prompts.Add "EUID", "5555"
Dim a1 As Range
Set a1 = Sheet5.Range("A1")
sas.InsertStoredProcess "/User Folders/Stored Process 1", c1, prompts
End Sub

推荐答案

你可以试试这个:

Sub InsertStoredProcessWithPrompts()
Dim sas As SASExcelAddIn
Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object
Dim prompts As SASPrompts
Set prompts = New SASPrompts
prompts.Add "EUID", activesheet.cells(1,2).value 'This is cell B1
Dim a1 As Range
Set a1 = Sheet5.Range("A1")
sas.InsertStoredProcess "/User Folders/Stored Process 1", c1, prompts
End Sub

这篇关于如何在 Excel 中键入 SAS 提示值以运行存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆