Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Focus (VBA/Word & Excel)

    I have a vague concept of the term "Focus" as used in VBA but would like to understand the term, and its use within VBA completely. I have not been able to locate a tutorial that covers it in a manner that satisfies my need. If anyone can point me in the right direction I would appreciate it greatly.

    T.I.A.
    Regards
    Don

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Focus (VBA/Word & Excel)

    This term applies to controls on userforms. To say that a control has the focus is the same as saying that the control is the active control. If a text box or combo box has the focus, the text in the box is highlighted or there is a blinking insertion point in the box. Most other controls have a dotted outline around their caption if they have the focus.
    If a control has the focus, keystrokes will be received by (processed by) this control.
    One sets focus to a different control by
    - Pressing the Tab key.
    - Clicking on the control with the mouse.
    - Pressing Alt+the character that is underlined in the caption of the control or the associated label.
    - Using ControlName.SetFocus in VBA.
    Does this help?
    Attached Images Attached Images
    • File Type: png x.PNG (7.4 KB, 0 views)

  3. #3
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Focus (VBA/Word & Excel)

    Thank you Hans

    It certainly does help. I was trying to relate the term to procedures, and had convinced myself that in a
    "With ActiveDocument" construct the active document would have the focus.

    Thank you again for the clarification.
    Regards
    Don

Posting Permissions

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