application.inputbox doesn't control screen coordinates

  • No matter what coordinates I place in this InputBox, the box always appears in the same position on the screen. [I've never have posted my code to this forum; I hope I did this correctly]:

    prompter = "You have either of two choices:" & Chr(10) & Chr(10) & vbTab & Chr(34) _
                       & "1 - zero-cost only" & Chr(10) & vbTab & Chr(34) _
                       & "2 - zero-cost and no scope" & Chr(10) & Chr(10) & Chr(10)
    Choice = Application.InputBox(prompter, "Choose Type of Consolidation", 1, Left:=1000, Top:=800, Type:=1 ) ' Type:=1 restricts Input Box to accept a number only

    Have tried with and without the Left:= and Top:= qualifiers on the parameter list; same effect.

    Also, won't allow me to trap the Excape/Cancel key, even if I chnage paramter to Type:=1+4 which is waht Microsoft MSDN says to do as shown here:

    "The following table lists the values that can be passed in the Type argument. Can be one or a sum of the values. For example, for an input box that can accept both text and numbers, set Type to 1 + 2." [1 means 'number', 2 means 'string/text'].

    MSDN also says that applixcation.inputbox should call the InputBox Method, not the InputBox function, and should fit this syntax:

    expression .InputBox(Prompt, Title, Default, Left, Top, HelpFile, HelpContextID, Type)expression A variable that represents an Application object.

    Use of a MesgBox automatically puts my prompt box in center of screen but it won't allow me to gather User Input. Really hate to use a UserForm when this method is supposed to work.

  • Re: application.inputbox doesn't control screen coordinates

    I am not sure what the problem is. I copied your code to a test workbook, changed the Left to 100 and the Top to 80 and added DIM Choice as Variant, prompter as String. Ran the code. It displays the Inputbox where it should be, accepts a numeric value that goes into Choice, or if Cancel is clicked then Choice is False. if Escape is pressed, Choice is False also. The Type parameter does not trap the Escape/Cancel key; it just defines the acceptable type of input for the box (e.g. numeric, text, range, etc.)

    If I am missing something here, let me know but I think your code is working (provided the Left and Top values are not too large).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!