有关InputBox

本文详细介绍了VBA中InputBox函数的功能及用法,包括如何通过该函数显示提示对话框并获取用户输入的数据。文章还解释了如何设置对话框的标题、默认值以及位置等参数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Technorati 标签: InputBox, VBA

来自:Julitta Korol,“Access.2003.Programming.by.Example.with.VBA.XML.and.ASP”,by Wordware Publishing, Inc. 2005, p67-p69

The InputBox function displays a dialog box with a message that prompts the user to enter data. This dialog box has two buttons: OK and Cancel. When you click OK, the InputBox function returns the information entered in the text box. When you select Cancel, the function returns the empty string (" "). The syntax of the InputBox function is as follows:

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

  1. The first argument, prompt, is the text message you want to display in the dialog box. Long text strings can be entered on several lines by using the Chr(13) or Chr(10) functions.All the remaining InputBox arguments are optional.
  2. The second argument, title, allows you to change the default title of the dialog box. The default value is “Microsoft Access.”
  3. The third argument of the InputBox function, default, allows the display of a default value in the text box. If you omit this argument, the empty edit box is displayed.
  4. The following two arguments, xpos and ypos, let you specify the exact position where the dialog box should appear on the screen. If you omit these arguments, the input box appears in the middle of the current window. The xpos argument determines the horizontal position of the dialog box from the left edge of the screen. When omitted, the dialog box is centered horizontally. The ypos argument determines the vertical position, from the top of the screen. If you omit this argument, the dialog box is positioned vertically approximately one-third of the way down the screen. Both xpos and ypos are measured in special units called twips. One twip is the equivalent of approximately 0.0007 inches.
  5. The last two arguments, helpfile and context, are used in the same way as the corresponding arguments of the MsgBox function discussed earlier in this chapter.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值