简体   繁体   English

Excel VBA-Workbook(“”)将工作簿名称设置为从用户窗体输入的变量

[英]Excel VBA - Workbook(“”) setting workbook name as a variable input from userform

I'm wanting to set the Workbook name as a variable, which is specified by a user in the userform, txtWBName 我想将工作簿名称设置为变量,由用户在用户表单txtWBName中指定

eg, 例如,

sWBName = userform1.txtWBName

Set wb = Workbooks(" + sWBName + "): wb.Activate

I not quite sure how to code it, between the ""... 我不太确定如何在“ ...”之间进行编码。

Can someone please help me. 有人可以帮帮我吗。 thanks in advance. 提前致谢。

您可以简单地传递变量名称,例如

Workbooks(sWBName)

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

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