VBA study notes - the input box

Learning materials https://www.yiibai.com/vba/vba_input_box.html

Input box InputBox

Function Description

Prompts the user to enter a value. When the input value, if the user clicks the OK button or by pressing the ENTER key on the keyboard, the InputBox function returns the text in the text box. If the user clicks "Cancel" button, the function returns an empty string ( "").

Idiom

InputBox(prompt[,title][,default][,xpos][,ypos][,helpfile,context])

parameter

parameter Options Types of Explanation Defaults
Prompt essential String The maximum length of prompt is approximately 1024 characters. If the message is extended to multiple lines, you may be used between each row carriage (Chr (13)) or a line feed (Chr (10)) to separate lines
title Optional String If the title is left blank, the application name will be placed in the title bar
default Optional String The default text that the user wishes to display the text box
xpos Optional digital X-axis represents the horizontal position of the tips of the distance from the left side of the screen If left empty, the input box is centered horizontally
ypos Optional digital The Y-axis direction indicates the vertical distance from the tips of the left side of the screen If left blank, the input box vertically centered
helpfile Optional String table Identification is used to provide context-sensitive help for the dialog help files
context Optional digital Used to identify the distribution of the aid to the appropriate help topic Help context number. If you provide context, it must also provide helpfile.

Examples

Function CountArea()
   Dim Length As Double
   Dim Width As Double

   Length = InputBox("输入一个长度值: ", "输入长度")
   Width = InputBox("输入一个宽度值:", "输入宽度")
   findArea = Length * Width
   CountArea = findArea
    MsgBox(CountArea)
End Function

Meatball notes

Yesterday learned a wording is Const A As String = "abc"
and today they learned a wording is Dim A As Double
compared with Lua, basic grammar VBA language a bit long-winded.
Constants and variables are also used to distinguish between Const and Dim, assigned directly by double quotation marks and equal signs in Lua, the distinction between variable type just fine.
In addition, VBA there is a feature to determine statement End If If you must use to end.
Another key issue ...... capitalized
have to say, this language will really quite strict, is a little simple enough ah!

Guess you like

Origin www.cnblogs.com/lisaisacat/p/12300076.html