Hello community,
we discuss here the question of using UIs (User Interfaces) in the context of VBA. On the one hand it is possible to use the VBA forms or on the other hand it is possible to use the following ActiveX library: Quick Prompts. You find Quick Prompts here. With Quick Prompts it is easy possible to create an UI for VBS, e.g. to use it inside SAP GUI Scripting.
Here an example to create a form with the text input fields for the user name and the password. The passord is a masked input field.
'-Begin-----------------------------------------------------------------
'-Directives----------------------------------------------------------
Option Explicit
'-Variables-----------------------------------------------------------
Dim Form
'-Main----------------------------------------------------------------
Set Form = CreateObject("QuickPrompts.Form.2")
If IsObject(Form) Then
'-Setup form caption----------------------------------------------
Form.Caption = "User Name/Password Sample"
'-Create two textbox controls-------------------------------------
Form.CreateControl "TextBox", "txtUserName", "&User Name:"
Form.CreateControl "TextBox", "txtPassword", "&Password:"
'-Set password flag on second text box ---------------------------
Form.txtPassword.Password = vbTrue
'-Display the dialog, quit if user cancels------------------------
Do
Loop Until Form.DoModal()
'-Display result--------------------------------------------------
MsgBox "User Name = " & form.txtUserName.value & _
" Password = " & form.txtPassword.value
End If
'-End-------------------------------------------------------------------
Quick Prompts is from Topten Software and licensed under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 Australia License.
Cheers
Stefan