Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-21-2022, 06:47 AM
Matt C's Avatar
Matt C Matt C is offline Remove toggle button "focus" (dotted inner border) using VBA Windows 10 Remove toggle button "focus" (dotted inner border) using VBA Office 97-2003
Advanced Beginner
Remove toggle button "focus" (dotted inner border) using VBA
 
Join Date: May 2021
Location: London, UK
Posts: 30
Matt C is on a distinguished road
Question Remove toggle button "focus" (dotted inner border) using VBA

Hi folks



I have a number of toggle buttons dotted around my spreadsheet - not part of a userform - and every time I click on them the "focus" remains on the button, i.e. a dotted inner border appears. I have to click away from the button (to remove the dotted border) before I can use various menu items which are otherwise greyed out.

It would appear that Excel 2003 does not include the "TakeFocusOnClick" option - which I think is what I need. Is there a way of removing the button focus another way using VBA?

Thanks, Matt
Reply With Quote
  #2  
Old 05-21-2022, 08:18 AM
Logit Logit is offline Remove toggle button "focus" (dotted inner border) using VBA Windows 10 Remove toggle button "focus" (dotted inner border) using VBA Office 2007
Expert
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

What about :

Range("A1").Select

???
Reply With Quote
  #3  
Old 05-21-2022, 08:57 AM
Matt C's Avatar
Matt C Matt C is offline Remove toggle button "focus" (dotted inner border) using VBA Windows 10 Remove toggle button "focus" (dotted inner border) using VBA Office 97-2003
Advanced Beginner
Remove toggle button "focus" (dotted inner border) using VBA
 
Join Date: May 2021
Location: London, UK
Posts: 30
Matt C is on a distinguished road
Default

Would that not shoot the selection back up to the top of the spreadsheet? I have buttons in a frozen top pane so would rather the window stayed as it was.
Reply With Quote
  #4  
Old 05-21-2022, 09:06 AM
Logit Logit is offline Remove toggle button "focus" (dotted inner border) using VBA Windows 10 Remove toggle button "focus" (dotted inner border) using VBA Office 2007
Expert
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Yes it would.

Where would you like the focus to go ?
Reply With Quote
  #5  
Old 05-21-2022, 09:48 AM
Matt C's Avatar
Matt C Matt C is offline Remove toggle button "focus" (dotted inner border) using VBA Windows 10 Remove toggle button "focus" (dotted inner border) using VBA Office 97-2003
Advanced Beginner
Remove toggle button "focus" (dotted inner border) using VBA
 
Join Date: May 2021
Location: London, UK
Posts: 30
Matt C is on a distinguished road
Default

I would like to avoid the dotted border appearing on the button and keep the currently-selected cell selected (or highlighted, whatever the terminology may be).
Reply With Quote
  #6  
Old 05-21-2022, 09:58 AM
Logit Logit is offline Remove toggle button "focus" (dotted inner border) using VBA Windows 10 Remove toggle button "focus" (dotted inner border) using VBA Office 2007
Expert
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

I don't understand how you can have a currently selected cell and the focus still remain on the toggle button.

Best answers here are derived by posting your workbook for review. Do not include confidential information.
Reply With Quote
  #7  
Old 05-22-2022, 03:00 AM
p45cal's Avatar
p45cal p45cal is online now Remove toggle button "focus" (dotted inner border) using VBA Windows 10 Remove toggle button "focus" (dotted inner border) using VBA Office 2019
Expert
 
Join Date: Apr 2014
Posts: 863
p45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant future
Default

Include
ActiveCell.Activate
somewhere in the toggle button's code.
(If you're using triplestate on the button, the click event won't fire when it becomes null, so use another event such as the mouseup or change event.)
Reply With Quote
  #8  
Old 05-22-2022, 04:32 AM
Matt C's Avatar
Matt C Matt C is offline Remove toggle button "focus" (dotted inner border) using VBA Windows 10 Remove toggle button "focus" (dotted inner border) using VBA Office 97-2003
Advanced Beginner
Remove toggle button "focus" (dotted inner border) using VBA
 
Join Date: May 2021
Location: London, UK
Posts: 30
Matt C is on a distinguished road
Default

Quote:
Originally Posted by p45cal View Post
Include
ActiveCell.Activate
somewhere in the toggle button's code.
That did the trick. Many thanks, p45cal.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How Do I Get Rid of This Dotted Border Around a Table in Word 2016? ARNK Word 3 11-02-2016 05:04 PM
Toggle Button takes focus and thus changes selection NobodysPerfect Word VBA 1 10-11-2014 04:20 AM
Remove toggle button "focus" (dotted inner border) using VBA Toggle Button Squibble Word VBA 2 06-11-2014 05:36 PM
Remove toggle button "focus" (dotted inner border) using VBA dotted lines under text -- how to remove? Straitsfan Word 1 11-11-2013 11:55 AM
Remove toggle button "focus" (dotted inner border) using VBA How to remove the dotted lines from a table of content? aleemu Word 2 06-21-2013 08:20 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:59 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft