Results 1 to 10 of 10
  1. #1
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cursor location (Excel 2000)

    Is there a property or method that will let me know via VBA code that my cursor in in a cell or in the formula Bar?

  2. #2
    3 Star Lounger MacroAlan's Avatar
    Join Date
    Feb 2003
    Location
    St Louis, Missouri, USA
    Posts
    254
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: Cursor location (Excel 2000)

    In a cell, it is a cross and in the formula bar, it is a text tool. Do you want your code to make a determination before doing something?
    Alan

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Cursor location (Excel 2000)

    What are you trying to do - your overall objective?

    If the cursor is in the formula bar you are in Edit mode and macros will not run. Even if you are in Edit mode in the cell, macros will not run so there is no way to even run this code.

    Steve

  4. #4
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor location (Excel 2000)

    Yes I need to know, via VBA code, if I am in the formulaBar

  5. #5
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor location (Excel 2000)

    Well that is my problem, I need to know the location of my active cursor, in a cell of any location or in the formulaBar. From your reply it sounds like I am not able to tell the cursor location using VBA code.

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Cursor location (Excel 2000)

    I still would like to hear your goal. If you only need to know if it is in the formula bar, I'm a little confused as to why you would need code: just look at the screen. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Steve

  7. #7
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor location (Excel 2000)

    These involve special coded templates for customers where we have a COM addin that places bitmaps onto an Excel worksheet. One of the requirements is to prevent the user from placing a bitmap into the formulaBar area. Note the bitmap is placed where the cursor is located.

  8. #8
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Cursor location (Excel 2000)

    I've never worked with COM addins, but I think excel prevents you from placing anything but text into the formula bar.

    Are your users going to have the formula bar selected (so you will be in edit mode) or are you just worried about what the cursor position is? If you will not be in edit mode, why not use the activecell position instead of the cursor position for bitmap placement?

    If you are in edit mode, excel is essentially "locked" anyway and won't do a thing until you are out of edit mode. I don't know if COM addins get around this, but I know if you are in edit mode macros can not be run. Even if you goto explorer and open another workbook, the workbook will not open until you are done editing.

    Steve

  9. #9
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor location (Excel 2000)

    If your code is running, then the cursor is in a cell. Code will not run if you are in edit mode (ie. the cursor is in the formula bar).
    Legare Coleman

  10. #10
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor location (Excel 2000)

    <hr>Code will not run if you are in edit mode (ie. the cursor is in the formula bar).<hr>
    Except when you use the Timer API, which fires any code in any situation. Dangerous, since it may crash Excel hard. Dunno what COM addins can do with that respect.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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