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

查看:43
本文介绍了如何在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天全站免登陆