Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2023, 07:12 AM
Ddadoo57 Ddadoo57 is offline how to activate a controlMso Windows 11 how to activate a controlMso Office 2021
Advanced Beginner
how to activate a controlMso
 
Join Date: Feb 2023
Posts: 73
Ddadoo57 is on a distinguished road
Default how to activate a controlMso

Hello,



Can someone tell me how to activate a controlMso from VBA?

Here is what I have in my ribbon :
<control idMso="ReviewSendForReview" enabled="false" />

Thanks in advance !


Best regards,
David
Reply With Quote
  #2  
Old 02-18-2023, 10:22 PM
Peterson Peterson is offline how to activate a controlMso Windows 10 how to activate a controlMso Office 2019
Competent Performer
 
Join Date: Jan 2017
Posts: 141
Peterson is on a distinguished road
Default

Try this:


Code:
Application.CommandBars.ExecuteMso ("ReviewSendForReview")
Reply With Quote
  #3  
Old 02-19-2023, 03:32 AM
Ddadoo57 Ddadoo57 is offline how to activate a controlMso Windows 11 how to activate a controlMso Office 2021
Advanced Beginner
how to activate a controlMso
 
Join Date: Feb 2023
Posts: 73
Ddadoo57 is on a distinguished road
Default

Thank you very much for your feedback!

Actually, it's not "execute" the Mso control that I need, it's put enabled="True" to the line of code in the xlm file of my ribbon

<control idMso="ReviewSendForReview" enabled="false" />

It's a locked button in my personal bar, it is locked at le loading, and i want to unlock it after a certain user action.

My tab bar is called "TC_Tab".

Best Regards,
David
Attached Images
File Type: png control mso of my tab ribbon.png (13.3 KB, 14 views)
Reply With Quote
  #4  
Old 02-19-2023, 01:46 PM
Peterson Peterson is offline how to activate a controlMso Windows 10 how to activate a controlMso Office 2019
Competent Performer
 
Join Date: Jan 2017
Posts: 141
Peterson is on a distinguished road
Default

Sorry, I don't know how to do that. I can see the XML file for custom ribbons in the UI file here:

C:\Users\<username>\AppData\Local\Microsoft\Office \Word.officeUI

...and I can manipulate the boolean value there, but I don't know how to do it with VBA except to open/modify the .officeUI file externally, but it's already loaded when Word is open, so changing it has no effect. My guess is, to change it while Word is open, you'd need to programmatically remove the button, not change its visibility attribute, then add it back when Word is closed. Someone on this board will know how to do that.
Reply With Quote
  #5  
Old 02-19-2023, 02:32 PM
Ddadoo57 Ddadoo57 is offline how to activate a controlMso Windows 11 how to activate a controlMso Office 2021
Advanced Beginner
how to activate a controlMso
 
Join Date: Feb 2023
Posts: 73
Ddadoo57 is on a distinguished road
Default

That's okay! Anyway, thanks for your time!

Best Regards,
David
Reply With Quote
  #6  
Old 02-19-2023, 07:07 PM
Guessed's Avatar
Guessed Guessed is offline how to activate a controlMso Windows 10 how to activate a controlMso Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,994
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Rather than including in the ribbon code the Enabled=True, you need to use the attribute getEnabled and include a callback macro to work out whether the button is enabled or not

See Confused over getEnabled for Ribbon

Note that when fiddling with code AFTER the ribbon has loaded, you may discover the updated code doesn't execute. Either reload the ribbon or close/reopen the document containing the ribbon to ensure the code is working.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #7  
Old 02-20-2023, 02:19 AM
Ddadoo57 Ddadoo57 is offline how to activate a controlMso Windows 11 how to activate a controlMso Office 2021
Advanced Beginner
how to activate a controlMso
 
Join Date: Feb 2023
Posts: 73
Ddadoo57 is on a distinguished road
Default

Hello Guessed and thank you for your answer.

Great, I will try the callback on getEnabled. I hadn't thought about it!

Best REgards,
David
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Activate Access shconner Office 1 09-15-2016 10:18 PM
how to activate a controlMso How do I activate the status bar? rbantjes Word 2 06-29-2016 04:04 PM
how to activate a controlMso Activate fields Formd Word VBA 2 07-31-2015 11:19 AM
how to activate a controlMso Activate ms office again helpp Office 1 07-21-2015 01:55 PM
how to activate a controlMso check box will not activate survivo01 Word 1 10-04-2012 03:34 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:58 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