SlideShare a Scribd company logo
2
Most read
6
Most read
13
Most read
Parul Institute Of Engineering & Technology


Subject code:- 151006
Name of subject:- Visual Basic And Application


Name of unit:- Using Intrinsic Dialogs


(Topic):- InputBox


Name of faculty:- 1) Ms.Nupur mam


Name of students:- 1) Vivek Patel (Roll.no- 146)
                     2) Sagar Pandya (Roll.no-140)
InputBox
 Defination:
   InputBox is used to accept input from the user.
   An inputBox is a pop up box,similar to a
    message box which has a textBox.
   It also has a “OK” and “CANCEL” buttons.
   Syntax:

   InputBox(prompt [, title ] [, default ] [, xpos ]
    [, ypos ] [, helpfile ] [, context ] )
   A way to ask a user of your system a question
    is to use an Inputbox:
   Here's what we're trying to achieve:
   Ask the question:


   Display the answer:
   Here's the code:

   InputBox takes several arguments:
      Prompt
      Title
      Default
      Xpos
      Ypos
      HelpFile
      Context
   In this example, we have entered:
      Prompt: "How Many Apples Do You Want?"
      Title: "Apples"
      Default: 3


   We then display the choice back to the user,
    but using this in a practical way, we'd trap the
    answer and use it for something else
We check whether the return from the box is
""
   If "" then they've pressed the Cancel
   button, and we should exit.
Getting User Input With a
VBA Input Box
   This could be useful if you wanted to fill up a
    page with text and print it to see if the margins
    etc. look OK.
   1. Open a new document in Word.
   2. Open the VBA Editor (Tools>Macro>Visual
    Basic Editor).
   3. Copy the following text from Sub
    InputBoxInsertText() to End Sub, inclusively.
   Sub InputBoxInsertText()
     Selection.HomeKey wdStory
     TheSentence = InputBox("Type Text Please", "Using
    the VBA Input Box")
     HowManyTimes = InputBox("How many times",
    "Using the VBA Input Box")
     For Counter = 1 To HowManyTimes
     Selection.TypeText TheSentence & " "

    Next

    End Sub
   4. Put the cursor anywhere within this code
    block.
   5. Press F5
   6. Type a word or two into the first VBA input
    box that appears.
   7. Type a number (between 50 and 100) into
    the second Input Box.
8. Go to the new document you opened and see
how the word or two that you typed into the
input box appears repeated the amount of times
corresponding to value you entered into the
second input box.
ARGUMENT
 prompt :
   Required.
   String expression displayed as the message in
    the dialog box. The maximum length
    ofprompt is approximately 1024 characters,
    depending on the width of the characters
    used.
   Ifprompt consists of more than one line, you
    can separate the lines using a carriage return
    character , a linefeed character , or carriage
    return–linefeed character combination
 title   :
   Optional. String expression displayed in the
    title bar of the dialog box. If you omit title, the
    application name is placed in the title bar.
 Default:
   Optional. String expression displayed in the
    text box as the default response if no other
    input is provided. If you omit default, the text
    box is displayed empty.
 Xpos:
   Optional.
   Numeric expression that specifies, in twips,
    the horizontal distance of the left edge of the
    dialog box from the left edge of the screen.
    If xpos is omitted, the dialog box is
    horizontally centered.
 Ypos:
   Optional.
   Numeric expression that specifies, in twips,
    the vertical distance of the upper edge of the
    dialog box from the top of the screen.
   If ypos is omitted, the dialog box is vertically
    positioned approximately one-third of the way
    down the screen.
 Helpfile:
   Optional.
   String expression that identifies the Help file to
    use to provide context-sensitive Help for the
    dialog box.
   If helpfile is provided, context must also be
    provided.
INPUT BOX- VBA

More Related Content

What's hot (20)

PPTX
What is html and how it uses/
abhishek9260
 
PPTX
Dialog box in vb6
Saroj Patel
 
PPTX
Visual Basic Controls ppt
Ranjuma Shubhangi
 
PPTX
Master page in Asp.net
RupinderjitKaur9
 
PPTX
Looping statement in vb.net
ilakkiya
 
PPT
Circular linked list
chauhankapil
 
PPTX
Variable and constants in Vb.NET
Jaya Kumari
 
PPT
Queue AS an ADT (Abstract Data Type)
Self-Employed
 
PDF
Introduction to html
eShikshak
 
PDF
Arrays in Visual Basic Programming
Kasun Ranga Wijeweera
 
PPTX
Basic controls of Visual Basic 6.0
Salim M
 
PPT
Xpath presentation
Alfonso Gabriel López Ceballos
 
PPTX
HTML Text formatting tags
Himanshu Pathak
 
PPTX
String Manipulation in Python
Pooja B S
 
PPTX
Presentation on python
william john
 
PPTX
Python dictionary
Sagar Kumar
 
PPTX
Python for loop
Aishwarya Deshmukh
 
PPT
Structures
archikabhatia
 
What is html and how it uses/
abhishek9260
 
Dialog box in vb6
Saroj Patel
 
Visual Basic Controls ppt
Ranjuma Shubhangi
 
Master page in Asp.net
RupinderjitKaur9
 
Looping statement in vb.net
ilakkiya
 
Circular linked list
chauhankapil
 
Variable and constants in Vb.NET
Jaya Kumari
 
Queue AS an ADT (Abstract Data Type)
Self-Employed
 
Introduction to html
eShikshak
 
Arrays in Visual Basic Programming
Kasun Ranga Wijeweera
 
Basic controls of Visual Basic 6.0
Salim M
 
HTML Text formatting tags
Himanshu Pathak
 
String Manipulation in Python
Pooja B S
 
Presentation on python
william john
 
Python dictionary
Sagar Kumar
 
Python for loop
Aishwarya Deshmukh
 
Structures
archikabhatia
 

Viewers also liked (20)

PPTX
Objects and classes in Visual Basic
Sangeetha Sg
 
PPS
InputBox
Ricardo Viqueira
 
PPS
Notas InputBox
Ricardo Viqueira
 
PPS
Procedures functions structures in VB.Net
tjunicornfx
 
PDF
Part19 inputbox using for..loop
Girija Muscut
 
PPS
CALCULADORA INPUTBOX
Ricardo Viqueira
 
PPTX
Menu pop up menu mdi form and playing audio in vb
Amandeep Kaur
 
PPTX
Object oriented programming concepts
rahuld115
 
PPTX
Debugging
nicky_walters
 
PPT
Dotnet framework
Nitu Pandey
 
PPT
The complete ASP.NET (IIS) Tutorial with code example in power point slide show
Subhas Malik
 
PPT
Inheritance, Object Oriented Programming
Arslan Waseem
 
DOCX
Uso de la función InputBox y MsgBox
Lic. Rolando Torres
 
PPTX
Inheritance in oops
Hirra Sultan
 
PPTX
Error handling and debugging in vb
Salim M
 
PDF
Object-oriented Programming-with C#
Doncho Minkov
 
PPTX
Strings in Java
Abhilash Nair
 
PPTX
Constructors & destructors
ForwardBlog Enewzletter
 
PPTX
Exception handling
Abhishek Pachisia
 
Objects and classes in Visual Basic
Sangeetha Sg
 
Notas InputBox
Ricardo Viqueira
 
Procedures functions structures in VB.Net
tjunicornfx
 
Part19 inputbox using for..loop
Girija Muscut
 
CALCULADORA INPUTBOX
Ricardo Viqueira
 
Menu pop up menu mdi form and playing audio in vb
Amandeep Kaur
 
Object oriented programming concepts
rahuld115
 
Debugging
nicky_walters
 
Dotnet framework
Nitu Pandey
 
The complete ASP.NET (IIS) Tutorial with code example in power point slide show
Subhas Malik
 
Inheritance, Object Oriented Programming
Arslan Waseem
 
Uso de la función InputBox y MsgBox
Lic. Rolando Torres
 
Inheritance in oops
Hirra Sultan
 
Error handling and debugging in vb
Salim M
 
Object-oriented Programming-with C#
Doncho Minkov
 
Strings in Java
Abhilash Nair
 
Constructors & destructors
ForwardBlog Enewzletter
 
Exception handling
Abhishek Pachisia
 
Ad

Similar to INPUT BOX- VBA (20)

PPTX
Looping in PythonLab8 lecture slides.pptx
adihartanto7
 
DOCX
Article link httpiveybusinessjournal.compublicationmanaging-.docx
fredharris32
 
PDF
Tm 1st quarter - 2nd meeting
Esmeraldo Jr Guimbarda
 
PDF
Hello, I need help with the following assignmentThis assignment w.pdf
namarta88
 
DOCX
import java.util.Scanner;Henry Cutler ID 1234 7202.docx
wilcockiris
 
PDF
Python assignment 4
ANILBIKAS
 
PDF
I x scripting
Alex do Amaral Dias
 
PPTX
VKS-Python Basics for Beginners and advance.pptx
Vinod Srivastava
 
PDF
Notes1
hccit
 
PDF
Solid C++ by Example
Olve Maudal
 
DOC
Winisisx
Victor789
 
PPT
Chapter2pp
J. C.
 
PPTX
F# Console class
DrRajeshreeKhande
 
PPT
python1.ppt
arivukarasi2
 
PDF
Wp100963 jython scripting with wsadmin tutorial
Alexandre Jesus Marcolino
 
DOCX
Hey i have attached the required file for my assignment.and addi
sorayan5ywschuit
 
PDF
Python for Physical Science.pdf
MarilouANDERSON
 
PPTX
PYTHON 101.pptx
MarvinHoxha
 
DOCX
Question 1 briefly respond to all the following questions. make
YASHU40
 
PPTX
Vks python
Vinod Srivastava
 
Looping in PythonLab8 lecture slides.pptx
adihartanto7
 
Article link httpiveybusinessjournal.compublicationmanaging-.docx
fredharris32
 
Tm 1st quarter - 2nd meeting
Esmeraldo Jr Guimbarda
 
Hello, I need help with the following assignmentThis assignment w.pdf
namarta88
 
import java.util.Scanner;Henry Cutler ID 1234 7202.docx
wilcockiris
 
Python assignment 4
ANILBIKAS
 
I x scripting
Alex do Amaral Dias
 
VKS-Python Basics for Beginners and advance.pptx
Vinod Srivastava
 
Notes1
hccit
 
Solid C++ by Example
Olve Maudal
 
Winisisx
Victor789
 
Chapter2pp
J. C.
 
F# Console class
DrRajeshreeKhande
 
python1.ppt
arivukarasi2
 
Wp100963 jython scripting with wsadmin tutorial
Alexandre Jesus Marcolino
 
Hey i have attached the required file for my assignment.and addi
sorayan5ywschuit
 
Python for Physical Science.pdf
MarilouANDERSON
 
PYTHON 101.pptx
MarvinHoxha
 
Question 1 briefly respond to all the following questions. make
YASHU40
 
Vks python
Vinod Srivastava
 
Ad

More from ViVek Patel (7)

PPT
Cdma wireless security
ViVek Patel
 
PDF
Report on wireless System CDMA security
ViVek Patel
 
PPTX
Any Surface Drum Kit
ViVek Patel
 
PPT
Code Division Multiple Access- CDMA
ViVek Patel
 
PPTX
E-town Banking system
ViVek Patel
 
PPT
Programming 8051 Timers
ViVek Patel
 
PPT
Introduction to Strategic Managment
ViVek Patel
 
Cdma wireless security
ViVek Patel
 
Report on wireless System CDMA security
ViVek Patel
 
Any Surface Drum Kit
ViVek Patel
 
Code Division Multiple Access- CDMA
ViVek Patel
 
E-town Banking system
ViVek Patel
 
Programming 8051 Timers
ViVek Patel
 
Introduction to Strategic Managment
ViVek Patel
 

INPUT BOX- VBA

  • 1. Parul Institute Of Engineering & Technology Subject code:- 151006 Name of subject:- Visual Basic And Application Name of unit:- Using Intrinsic Dialogs (Topic):- InputBox Name of faculty:- 1) Ms.Nupur mam Name of students:- 1) Vivek Patel (Roll.no- 146) 2) Sagar Pandya (Roll.no-140)
  • 2. InputBox  Defination:  InputBox is used to accept input from the user.  An inputBox is a pop up box,similar to a message box which has a textBox.  It also has a “OK” and “CANCEL” buttons.
  • 3. Syntax:  InputBox(prompt [, title ] [, default ] [, xpos ] [, ypos ] [, helpfile ] [, context ] )
  • 4. A way to ask a user of your system a question is to use an Inputbox:  Here's what we're trying to achieve:  Ask the question: 
  • 5. Display the answer:
  • 6. Here's the code: 
  • 7. InputBox takes several arguments:  Prompt  Title  Default  Xpos  Ypos  HelpFile  Context
  • 8. In this example, we have entered:  Prompt: "How Many Apples Do You Want?"  Title: "Apples"  Default: 3  We then display the choice back to the user, but using this in a practical way, we'd trap the answer and use it for something else
  • 9. We check whether the return from the box is "" If "" then they've pressed the Cancel button, and we should exit.
  • 10. Getting User Input With a VBA Input Box  This could be useful if you wanted to fill up a page with text and print it to see if the margins etc. look OK.  1. Open a new document in Word.  2. Open the VBA Editor (Tools>Macro>Visual Basic Editor).  3. Copy the following text from Sub InputBoxInsertText() to End Sub, inclusively.
  • 11. Sub InputBoxInsertText() Selection.HomeKey wdStory TheSentence = InputBox("Type Text Please", "Using the VBA Input Box") HowManyTimes = InputBox("How many times", "Using the VBA Input Box") For Counter = 1 To HowManyTimes Selection.TypeText TheSentence & " " Next End Sub
  • 12. 4. Put the cursor anywhere within this code block.  5. Press F5  6. Type a word or two into the first VBA input box that appears.  7. Type a number (between 50 and 100) into the second Input Box.
  • 13. 8. Go to the new document you opened and see how the word or two that you typed into the input box appears repeated the amount of times corresponding to value you entered into the second input box.
  • 14. ARGUMENT  prompt :  Required.  String expression displayed as the message in the dialog box. The maximum length ofprompt is approximately 1024 characters, depending on the width of the characters used.  Ifprompt consists of more than one line, you can separate the lines using a carriage return character , a linefeed character , or carriage return–linefeed character combination
  • 15.  title :  Optional. String expression displayed in the title bar of the dialog box. If you omit title, the application name is placed in the title bar.  Default:  Optional. String expression displayed in the text box as the default response if no other input is provided. If you omit default, the text box is displayed empty.
  • 16.  Xpos:  Optional.  Numeric expression that specifies, in twips, the horizontal distance of the left edge of the dialog box from the left edge of the screen.  If xpos is omitted, the dialog box is horizontally centered.
  • 17.  Ypos:  Optional.  Numeric expression that specifies, in twips, the vertical distance of the upper edge of the dialog box from the top of the screen.  If ypos is omitted, the dialog box is vertically positioned approximately one-third of the way down the screen.
  • 18.  Helpfile:  Optional.  String expression that identifies the Help file to use to provide context-sensitive Help for the dialog box.  If helpfile is provided, context must also be provided.