PowerPoint VBA InputBox Location and How to Position It

VBA & macros · Updated November 18, 2026

In PowerPoint VBA, call the built-in InputBox function from a macro; its optional XPos and YPos arguments set the dialog’s position on the screen. If you omit them, the dialog is centered horizontally and appears about one-third of the way down the screen. These coordinates refer to the display, not to a slide.

Where InputBox lives in PowerPoint VBA

InputBox is a function you use in VBA code, not a PowerPoint ribbon command or a dialog that you insert onto a slide. It displays a small prompt with a text field and returns the text the user enters. You can call it from a procedure in a standard VBA module, such as a macro that asks for a presentation title or a name to use in a later step.

On PowerPoint for Microsoft 365 on Windows, open the Visual Basic Editor with Alt+F11, or select Developer > Visual Basic if the Developer tab is visible. In the editor, choose Insert > Module, then put the procedure in that module. If Developer is not on the ribbon, enable it through File > Options > Customize Ribbon and select the Developer checkbox.

PowerPoint for Mac also supports VBA, but its menus and keyboard shortcuts can differ by version and keyboard configuration. Use the Developer tab’s Visual Basic command when available rather than assuming the Windows shortcut will work. To retain VBA code, save the presentation as a macro-enabled PowerPoint file (.pptm); a regular .pptx file does not store VBA macros.

How XPos and YPos control the dialog

The function accepts a prompt and optional settings, including a title, default text, and screen coordinates. The relevant argument order is InputBox(prompt, title, default, xpos, ypos). The coordinate arguments specify the left edge and top edge of the dialog, respectively. They are measured in twips: 1,440 twips equals one inch.

Because these are positional arguments, you must supply the earlier arguments before you can provide XPos and YPos. If you want no prefilled text, pass an empty string for default, as in the example below. Leaving the coordinate arguments out is also valid and uses the default placement.

  • XPos is the distance from the screen’s left edge to the dialog’s left edge.
  • YPos is the distance from the screen’s top edge to the dialog’s top edge.
  • Coordinates are not PowerPoint slide units, points on a slide, or the location of the selected object.

For example, 2880 twips is 2 inches and 1440 twips is 1 inch. Those values request a position whose top-left corner is two inches from the screen’s left edge and one inch down from its top edge. The dialog’s dimensions are not specified by these arguments.

Example: place the prompt at a chosen screen position

This example requests a presenter’s name and places the prompt at the example coordinates. It then displays the entered value. The test for an empty result is intentional: the built-in function returns an empty string both when the user clicks Cancel and when the user submits a blank response, so this simple example treats both cases alike.

Sub AskForPresenterName()
    Dim presenterName As String

    ' Request a name; position the dialog 2 inches right and 1 inch down.
    presenterName = InputBox("Enter the presenter name:", _
                             "Presentation details", "", 2880, 1440)

    ' An empty result can mean Cancel or a blank submission.
    If Len(presenterName) = 0 Then
        MsgBox "No name was entered."
        Exit Sub
    End If

    MsgBox "Presenter: " & presenterName
End Sub

The underscore at the end of a VBA line continues the statement on the next line. To try the macro, place the cursor inside the procedure in the Visual Basic Editor and use Run > Run Sub/UserForm or press F5 on Windows. The prompt appears on the screen while PowerPoint is running; it is not embedded in the slide show as slide content.

Putting and running the code in PowerPoint

To add the example, create a standard module and paste the complete procedure into it. Return to PowerPoint and save the presentation as a .pptm file. If PowerPoint displays a security warning when you open the file, only enable macros for a presentation whose source you trust. Macro security settings can be managed through PowerPoint’s Trust Center; do not lower them indiscriminately just to make one prompt run.

When the macro is launched, PowerPoint may show a security notification or block it, depending on the file’s source and the organization’s policies. In a managed workplace, an administrator may control those settings. A macro-enabled file is not the same as a macro that runs automatically: the sample runs when you start its procedure, and it does not run merely because a slide is opened.

Before running a macro that edits a presentation, save a separate copy of the presentation. VBA changes generally cannot be reversed with Ctrl+Z, so a backup is a safer way to recover from unintended changes. The sample above only asks for text and shows a message; it does not change slides.

What the coordinates mean in practice

The requested position is tied to the screen environment, not the slide canvas. Changing the slide size, switching between Normal and Slide Show view, or moving a slide object does not define the InputBox coordinates. If you want to place a prompt relative to a particular shape or slide element, the built-in function is not designed to do that.

Also, coordinates alone do not guarantee that the dialog will look identical on every computer. Display scaling, screen resolution, and multi-monitor arrangements can affect how a requested position appears. A coordinate near the screen edge can put some or all of the dialog outside the visible area, because the arguments locate its top-left corner rather than automatically keeping the whole dialog on-screen.

Choose a conservative location and check it on the display setup that matters to your users. If a prompt must remain visible in a specific place, adapt to the screen arrangement, or have a consistent branded appearance, consider a UserForm instead. A UserForm offers more layout control, but it requires more setup than a one-line InputBox call.

Common location and input problems

  • The prompt appears in the default location. Check that the call includes both coordinate arguments in the correct order, after the title and default-text arguments. Omitting an earlier argument or placing a number in the wrong position can produce an unintended result.
  • The dialog is partly off-screen. Reduce the requested coordinates and test again. Remember that the values position the dialog’s top-left corner, not its center.
  • The prompt is on the wrong monitor or looks shifted. Screen arrangement and scaling can affect placement. Avoid assuming that one coordinate pair will be visually identical on all users’ setups.
  • The macro will not run. Confirm that the file is saved as .pptm, that the code is in a module, and that macro security permits the file to run. On a Mac, the editor’s access path and shortcuts may differ from Windows.
  • Cancel is treated like an empty answer. The built-in function does not give a separate Cancel flag. If the distinction matters, use a different input design, such as a custom form with separate controls.

A frequent misconception is that XPos and YPos place the prompt over a particular slide location. They do not: a slide is a document canvas, while this prompt is a separate window displayed by the application. To gather input during a presentation and display it as part of the slide, VBA would need to take the response and write it into a slide element separately.

When a UserForm is a better choice

Use InputBox when the task is a single, simple text question and a standard prompt is sufficient. Choose a VBA UserForm when the interaction needs several fields, labels, validation messages, buttons with distinct actions, or a more controlled layout. A form can also distinguish an explicit Cancel button from a blank text field because you design those controls and their behavior.

UserForms take more work: you create the form, add controls such as text boxes and command buttons, and write code for their events. Their position can be controlled through form properties such as StartUpPosition, Left, and Top, subject to the form’s behavior and the user’s display. That added control is useful for repeated or structured data entry, but is often unnecessary for one quick prompt.

PowerPoint InputBox versus Excel Application.InputBox

Examples written for Excel sometimes use Application.InputBox, which is an Excel-specific method with options that differ from the VBA language’s built-in InputBox function. Do not assume that Excel’s application method is available in PowerPoint. In PowerPoint VBA, the built-in InputBox function is the straightforward choice for requesting text; use its optional title, default, and position arguments as needed.

The built-in function returns text. It does not automatically validate a number, select a file, or identify a slide object. If the response must be numeric or match a particular format, check the returned string in your code before using it. For more advanced input, use a purpose-built dialog or another suitable interface rather than borrowing an Excel-only example without checking its object model.

Frequently Asked Questions

Where do I find InputBox in PowerPoint?
It is a VBA function, not a ribbon button. Open the Visual Basic Editor, add or open a module, and call InputBox from a procedure.

How do I move a VBA InputBox in PowerPoint?
Pass horizontal and vertical coordinates as the fourth and fifth arguments: XPos and YPos. They locate the dialog from the screen’s left and top edges and use twips.

Can I position the InputBox on a slide?
No. Its position is on the application screen, not on the slide canvas. To show the user’s answer on a slide, write the response into a slide object with additional VBA code.

Why does InputBox return nothing when I click Cancel?
The built-in function returns an empty string for Cancel, and it also returns an empty string if the user submits a blank response. Use a custom form if those outcomes must be distinguished.

Can I change the size or appearance of the standard InputBox?
Not through its normal arguments. For custom sizing, multiple fields, or branded controls, build a VBA UserForm instead.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.