简体   繁体   English

添加输入框以将VBA Excel的用户名,密码插入Teradata查询

[英]Add Input Box to insert username, password for VBA Excel to Teradata query

I have VBA excel code that runs a SQL query in Teradata and spits the results back out into Excel. 我有VBA excel代码,它在Teradata中运行SQL查询并将结果反馈回Excel。 Instead of the following (which I have in my code), I would like to have an "input box" pop up for the user to input their user ID and password, instead of having it sitting in the code itself, for security reasons. 出于安全原因,我希望弹出一个“输入框”,供用户输入用户ID和密码,而不是将其放在代码本身中,而不是以下(我的代码中有)。 Any ideas/Is this possible? 任何想法/这可能吗? I have worked with message boxes and inputs before, but am stumped on how to do it for this instance. 我以前曾使用过消息框和输入,但我对如何为此实例进行操作感到困惑。 Thanks! 谢谢!

 connect.Open "Data Source=****; Database=****; Persist Security Info=True; User ID=****; Password=****; Session Mode=ANSI;"
strUser = InputBox("User ID")
strPwd = InputBox("Password") 
connect.Open "Data Source=****; Database=****; Persist Security Info=True; User ID=" & strUser & "; Password=" & strPwd & "; Session Mode=ANSI;"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM