Home | Computer | Software
Message Box When small informational messages or simple questions need to be asked, the MsgBox (message box) function can be used. A primary advantage of using a message box is that it lets you present a message to the user that can’t be ignored. The syntax of a message box statement is shown here. MsgBox (prompt [, buttons] [, title][, helpfile, context]) as Integer Prompt A required argument for the MsgBox function that contains the text that is displayed within the message box. Buttons Optional numerical argument used to specify the buttons and the icon that is to be displayed within the message box. Title Optional string argument used to specify the text to be displayed within the message boxes title bar. If omitted, “Microsoft Office Excel” is displayed. Helpfile Optional string argument used to specify the help file used to provide context-sensitive help. Context Optional numerical argument that is the Help context number assigned to the appropriate Help topic. If a Cancel button is displayed in the message box, pressing Esc has the same effect as clicking it. The simple message box can be displayed as following Sub Welcome ( ) MsgBox (“Welcome To Excel”) End Sub Input Box An input box is similar to a message box in that it displays text, but it has the additional functionality of being able to accept text responses from users. Instead of presenting the user with a few buttons that can be clicked in response to messages displayed in the window, input boxes contain a text box where the user can type in responses. InputBox (prompt [, title][, default][, xpos][, ypos][, helpfile, context]) as String Prompt Required argument for the InputBox function that contains the text that is displayed within the input box. Title Optional string argument used to specify the text to be displayed within the input boxes title bar. Default Optional string value that is displayed within the text box as the default value if no other information is entered. Xpos Optional numeric expression that represents the number of twips from the left edge of the screen to the left edge of the input box. Ypos Optional numeric expression that represents the number of twips from the top edge of the screen to the top edge of the input box. Helpfile Optional string argument used to specify the help file used to provide context-sensitive help. Context Optional numerical argument that is the Help context number assigned to the appropriate Help topic. The InputBox function returns a string value, so if the text box is blank or the Cancel button pressed, the returned string is empty. The returned value from an input box is usually stored within a string variable so that it can be processed further. Public Sub Example ( ) Dim StrInput as String Dim StrResponse as String StrInput = InputBox ("Please provide the text for Message Box", "Input Box Example") StrResponse = MsgBox (strInput, vbOKOnly, "Message Box") End Sub
Article Source: http://www.content.onlypunjab.com
World Web DirectoryWe are the fastest growing human edited web directory in the world. Listing of new website in 48 hours on static html pages with static text links.We are the only directory providing life time directory listing on static html pages. Excel VBA TutorialWe Provide Professional Training For Microsoft Excel and VBA With Video Example.
Please Rate this Article
5 out of 54 out of 53 out of 52 out of 51 out of 5
Not yet Rated