📄 vba11-6.txt
字号:
Public Sub UseGetStringDialog()
Dim pGetStringDialog As IGetStringDialog
Dim pMessageDialog As IMessageDialog
Dim blnOK As Boolean
Dim blnYes As Boolean
Dim strName As String
' Initiate the variables and objects
strName = "Bob"
blnYes = False
Set pGetStringDialog = New GetStringDialog
Set pMessageDialog = New MessageDialog
' Place the process in a loop so that
' it can be repeated.
Do While Not blnYes
' Display the Get String Dialog.
blnOK = pGetStringDialog.DoModal( _
"Get String Dialog Example", "Name:", strName, 0)
If blnOK Then
' Get the name that user provided.
strName = pGetStringDialog.Value
' Display the Message Dialog.
blnYes = pMessageDialog.DoModal( _
"Message Dialog Example", _
"Is your name " & strName & "?", _
"Yes", "No", 0)
Else
' User selected the Cancel button,
' end the macro.
Exit Do
End If
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -