اذهب الي المحتوي
أوفيسنا

كيف يمكنني تغيير الشريط الموجود في الخيارات برمجيا


الردود الموصى بها

السلام عليكم ورحمة الله وبركاته

لقد قمت بانشاء شريطين في اكسس الاول يعرض شريط اكسس مع الشريط ، والثاني يعرض الشريط فقط بدون شريط اكسس الرئيسي

المطلوب : كود يمكنني من تغيير الشريط المستخدم في نافذة الخيارات المرفقة في الصورة أو

اذا كان الشفت مفعل يستخدم الشريط الاول اما اذا كان الشريط غير مفعل يستخدم الشريط الثاني

image.png.afadd03b1e376f4349466d09ce9ed136.png

 

رابط هذا التعليق
شارك

اعتقد ولانه ليس لدي كمبيوتر الان يوجد حلول

منها انشئ جدول مؤقت وضع نفس الاسم للريبون

وضع خصائص الريبون  التي تريد واستدعي الريبون الذي تريد لجدول USysRibbons

او طريق ثانية

 

As a general rule one should attempt to figure out how to use one main ribbon for a given user. For forms then one can well easy “set” the ribbon in the forms on-load event. However, if you designed the ribbon correct, then you should only need one - and just hide or show a few of the options you want for "managers" or say "sales reps".

 

However for the application wide ribbon setting, quite sure this setting does not change until a re-start.

 

However a really “simple” and cool way around this issue is to set the application wide ribbon, but MAKE SURE the ribbon does not in fact exist. You then in your application start-up code using the LoadcustomerUI.

 

Remember the setting in a form or even the global ribbon is based on the “name” you give that ribbon WHEN you load it. For automatic loads from USYSRibbons, then the column “ribbon Name” is simply used.

 

However as noted you CAN specify ANY ribbon name when you use LoadCustomUI - and this includes any XML  you have for existing ribbons in the USYSRibbons table!

 

So you might have a global ribbon setting of “MyMain”, but make sure NO such ribbon actually exists. Then in your start-up code you can grab any ribbon from the USYSRibbons table and execute a loadCustomUI on that ribbon.

 

Eg:
Dim strRib    as string

‘Based on some user start-up setting, we want a managers ribbon, or a sales ribbon

If Manager = True then

   strRib = dlookup("RibbonXml","USysRibbons","RibboName = 'Manager')

else

   strRib = dlookup("RibbonXml","USysRibbons","RibboName = 'Sales')


End if


loadcustomui "MyMain",strRib

 

Note CAREFULLY how in above when you execute LoadCusteormUI you STATE the name you want to use – in this case “MyMain”. So this “MyMain” also happens to be the global ribbon setting you set for Access on startup. But note how that ribbon does not exist until you execute LoadCustomUI.

 

So the “name” you use when loading the ribbon can be the global setting in Access. Note that you can ONLY load into a given name ONE time for the duration of that application setting - so this will work to change the ribbon that displays - but you have to exit the application to switch that ribbon display again using this approach.

 

 

Regards,
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

 

رابط هذا التعليق
شارك

السلام عليكم أخي عبدالله 🙂 

جرب هذا الكود حصلت عليه من الذكاء الاصطناعي :

Private Sub ChangeRibbonName()
    Dim RibbonUI 
    Set RibbonUI = Application.CommandBars("Ribbon").Controls("MyRibbonTab")
    RibbonUI.Caption = "New Ribbon Tab Name"
End Sub

المصدر : https://poe.com/s/J0iF2yZJzcWS5qH5umBo

رابط هذا التعليق
شارك

من فضلك سجل دخول لتتمكن من التعليق

ستتمكن من اضافه تعليقات بعد التسجيل



سجل دخولك الان
  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information