+ Reply to Thread
Results 1 to 8 of 8

Text in a dialogue box

  1. #1
    Registered User
    Join Date
    10-15-2017
    Location
    Auckland, New Zealand
    MS-Off Ver
    365
    Posts
    3

    Text in a dialogue box

    My macro shows a dialogue box ("the box") awaiting user's input of a text string. There's a default text in the box already. I want to run (using the keyboard arrows, Home, End keys) through the characters of the default text in the box, to modify the text. However, this results in a spreadsheet range being automatically inserted within the text in the box.
    How to prevent that a spreadsheet range is automatically inserted within the text in the box when I use keyboard arrow keys?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,677

    Re: Text in a dialogue box

    I would not expect that to happen. Is the dialog box a UserForm that you built, or a built-in Excel dialog? What action is causing the dialog box to be displayed? Can you attach your file?

    The paper clip icon does not work for file attachments. Under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,165

    Re: Text in a dialogue box

    Hi Hanys and welcome to the forum,

    If you are using VBA and an InputBox then look at this site to see how to set the default value that goes in the box.

    https://msdn.microsoft.com/en-us/vba...x-method-excel
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    10-15-2017
    Location
    Auckland, New Zealand
    MS-Off Ver
    365
    Posts
    3

    Re: Text in a dialogue box

    Hi 6StringJazzer,

    Please use the following example code to see my problem:
    Please Login or Register  to view this content.
    After running the code don't press OK or Cancel in the dialogue box.
    Press left/right arrow key on the keyboard, or Home/End key.
    The word "Something" will change into a cell reference, e.g. "=$A$1",
    depending which cell of the spreadsheet was selected before running the macro.
    (At least this is what is happening in my spreadsheet.)

    I would like to use left/right arrow keys of the keyboard to run through
    the text "Something", and change it by typing, without grabbing the mouse and
    without deleting it.

    How to prevent cell reference appearing in the text field when I use arrow keys?

    Hanys
    Last edited by 6StringJazzer; 10-19-2017 at 09:43 AM.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Text in a dialogue box

    Try using InputBox instead of Application.InputBox.
    If posting code please use code tags, see here.

  6. #6
    Registered User
    Join Date
    10-15-2017
    Location
    Auckland, New Zealand
    MS-Off Ver
    365
    Posts
    3

    Re: Text in a dialogue box

    Norie,
    It was that simple.
    Thank you.
    Hanys

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Text in a dialogue box

    Pressing f2 should toggle between input and edit mode with the original code.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,677

    Re: Text in a dialogue box

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Dialogue Box VBA
    By KG23 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-15-2014, 01:27 PM
  2. Retrieving data from text boxes on a dialogue box
    By cptpies in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2012, 02:44 AM
  3. Pop up dialogue box
    By TG77 in forum Excel General
    Replies: 1
    Last Post: 06-28-2010, 11:15 AM
  4. dialogue pop up
    By Micayla Bergen in forum Excel General
    Replies: 5
    Last Post: 06-23-2006, 05:50 PM
  5. pop up dialogue box
    By Micayla Bergen in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-22-2006, 09:40 PM
  6. pop up dialogue
    By Micayla Bergen in forum Excel General
    Replies: 0
    Last Post: 06-22-2006, 09:25 PM
  7. Open dialogue box and importing text files
    By Gazzr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-16-2006, 07:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1