且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从vbscript自动在Excel文件中填写Excel用户窗体

更新时间:2023-12-06 13:03:46

一种方法是使用 SendKeys 这样的功能

One way to do that is to use SendKeys function like this

SendKeys "Value1{Tab}Value2{Return}"

上面的代码将用字符串"Value1"填充第一个字段,然后焦点将转移(由于发送了TAB),然后第二个字段将获得"Value2".如果您需要按Enter键,也可以这样做.

The above code will fill the first field with the string "Value1" then the focus will shift (because of TAB being sent) then the second field will get "Value2". If you need to press an Enter key then you can do that too.

您可以在此处阅读有关SendKeys函数,可以键入哪些键的更多信息,等等. http://msdn.microsoft.com/zh-cn/library/office/aa202943(v = office.10).aspx

You can read more about SendKeys function, what keys you can type, and so on here http://msdn.microsoft.com/en-us/library/office/aa202943(v=office.10).aspx