Is there any command equivalent to readline in vba?

Is there a command equivalent to readLine Java in VBA. I want to use text input in a direct window and put it in a variable. Is it possible?

+4
source share
2 answers

You cannot use the Immediate window interactively. Firstly, while the subroutine is running, it will not accept any keyboard input. However, you can use it to transfer data to a sub or function when it is called, so in a sense you can “copy” data that already exists. Something like that:

Sub AddNums(ParamArray nums())
    Dim total As Double
    Dim i As Long
    For i = 0 To UBound(nums)
        total = total + nums(i)
    Next i
    Debug.Print total
End Sub

For example:

enter image description here

- VBScript script, , VBA ( script), , , script . , , , ( ) VBA.

+4

, Immediate Window - ?

, , .

, , :

Sub Main()

    Dim immediateInput As String
    Dim readImmediate As Boolean
    Do While (readImmediate = False)
        readImmediate = True
    Loop

End Sub

readImmediate = true immediateInput Watch. .

, "":

immediateInput = "hello world"

; immediateInput "hello world".

enter image description here

+3

Source: https://habr.com/ru/post/1610221/


All Articles