Tab Focus

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Codebug
    New Member
    • Feb 2008
    • 25

    Tab Focus

    How do you change the tab page of a TabCtlBox using VB so that it has focus?

    I have an excel object on one of the pages but due to a function I have written to update the excel object, it will also move focus to the page this excel object is on. I have tried disabling the control whilst the update function is used: ie:

    MyTabCtl.enable d = false

    but then it returns an error, presumably because it cant then move focus to the excel object on its page.

    The TabIndex just seems to return a value of the current page.

    ie

    MyTabCtl.TabInd ex = 0
  • mshmyob
    Recognized Expert Contributor
    • Jan 2008
    • 903

    #2
    Are you looking for?

    [CODE=vb]
    Me.ctlPageName. setfocus
    [/CODE]

    Where ctlPageName = the tab control PAGE name.

    Originally posted by Codebug
    How do you change the tab page of a TabCtlBox using VB so that it has focus?

    I have an excel object on one of the pages but due to a function I have written to update the excel object, it will also move focus to the page this excel object is on. I have tried disabling the control whilst the update function is used: ie:

    MyTabCtl.enable d = false

    but then it returns an error, presumably because it cant then move focus to the excel object on its page.

    The TabIndex just seems to return a value of the current page.

    ie

    MyTabCtl.TabInd ex = 0

    Comment

    • FishVal
      Recognized Expert Specialist
      • Jun 2007
      • 2656

      #3
      Originally posted by Codebug
      How do you change the tab page of a TabCtlBox using VB so that it has focus?

      I have an excel object on one of the pages but due to a function I have written to update the excel object, it will also move focus to the page this excel object is on. I have tried disabling the control whilst the update function is used: ie:

      MyTabCtl.enable d = false

      but then it returns an error, presumably because it cant then move focus to the excel object on its page.

      The TabIndex just seems to return a value of the current page.

      ie

      MyTabCtl.TabInd ex = 0
      Do you mention tabcontrol in Access or in Excel. They are somewhat different.
      Access has it own tabcontrol while Excel uses one from MSForms library.

      Regards.
      Fish

      Comment

      Working...