我有一个vbs代码,我想改变显示InputBox
的方式。
我想创建一个InputBox
,而不是“确定”,“取消”按钮会显示不同的按钮标签
是否可以在vbs中使用?
谢谢
答案 0 :(得分:1)
内置InputBox
功能无法实现您的功能。您需要为此创建custom dialog:
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "about:blank"
ie.Document.title = "Title"
ie.ToolBar = False
ie.Resizable = False
ie.StatusBar = False
ie.Width = 320
ie.Height = 180
While ie.ReadyState <> 4 : WScript.Sleep 100 : Wend
ie.Document.body.innerHTML = _
"<p><input type='text' size='20' id='UserInput'></p>" & vbNewLine & _
"<p><input type='hidden' id='OK' name='OK' value='0'>" & _
"<input type='submit' value='Foo' onClick='VBScript:OK.value=1'></p>"
ie.Document.body.style.overflow = "auto"
ie.Visible = True
ie.Document.all.UserInput.focus
On Error Resume Next
Do While ie.Document.all.OK.value = 0
WScript.Sleep 100
Loop
On Error Goto 0
使用样式表自定义对话框的外观:
Set style = ie.Document.CreateStyleSheet
style.AddRule "*", "margin:0; padding:0; border:0;"
style.AddRule "body", "font-family:serif; font-size:12px; text-align:center;"
style.AddRule ".button", "border:2px outset; width:70px;"
...