+ Reply to Thread
Results 1 to 8 of 8

Show/Hide ActiveX Controls

  1. #1
    Registered User
    Join Date
    09-29-2014
    Location
    TIjuana, Mexico
    MS-Off Ver
    MSO 2010, MSO 2013
    Posts
    53

    Show/Hide ActiveX Controls

    Hello, can somebody help me? I'm creating a macro file that will be used by around 15 coworkers, but I want only to show certain buttons depending on their role.

    For example:
    Workers 1,2,4 and 5 will be able to view 4 macro buttons
    Workers 3,6,7 and 8 will be able to view 4 diferent macro buttons, not accesible to the previous set of workers.

    So far, I found this code to get the username from the person who opens the macro file

    Please Login or Register  to view this content.
    That's no issue, what I want to do is to put a command that enables/disables viewing certain ActiveX buttons depending on the user that opens the workbook.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Show/Hide ActiveX Controls

    You can manage the visibility of a button like this

    Please Login or Register  to view this content.
    I can't be any more specific without knowing the actual names of your buttons and roles that the users play. But hopefully this example is what you need.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Show/Hide ActiveX Controls

    Hello MarBoTJ,

    I think it would be easier to setup a Workbook with Passwords, since anyone could work on another users' PC, and you will be none the wiser.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    I will see how it could be changed as suggested.

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  4. #4
    Registered User
    Join Date
    09-29-2014
    Location
    TIjuana, Mexico
    MS-Off Ver
    MSO 2010, MSO 2013
    Posts
    53

    Re: Show/Hide ActiveX Controls

    Hey, thanks 6StringJazzer, it worked this way:

    Please Login or Register  to view this content.
    Also thanks Winon, I didn't consider the possibility (remote, but still possible) that other user might use one of the coworkers PC. I'll work on that point and let you know how it ends.

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Show/Hide ActiveX Controls

    Glad you got it to work. I would have provided something more specific but I didn't know the code was in the ThisWorkbook module or what the button names were.

    Winon has a good point about passwords, although in the final analysis any security mechanism that you would use in Excel is just guidance for people about what they should and shouldn't do. It is difficult (maybe impossible) to make this secure against someone who is deliberately trying to break the security.

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Show/Hide ActiveX Controls

    You're better off not using ActiveX controls on worksheets at all. They're incredibly unstable have a look here https://www.google.co.uk/webhp?sourc...eet%20controls and by using them, you're asking for trouble.

    Forms controls are much more reliable - they're in the same dropdown as the ActiveX ones, but are designed for use on worksheets - so you don't run into any stability issues, you can do most of the same things with them too and you can use them without using code.

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Show/Hide ActiveX Controls

    I suppose that is a matter of some debate. Some people do indeed have problems with sizing of ActiveX controls in some scenarios. As far as use on worksheets, I would agree you can do most of the same things with them, although if you can do something without code using a Forms control you can do it without code using an ActiveX control. If you do need code, ActiveX features are more powerful and straightforward.

    One size does not fit all.

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Show/Hide ActiveX Controls

    What's more straightforward than assigning a macro?

    Typically one only needs ActiveX controls if Events are needed - why would you want to use ActiveX controls at all if you aren't using code?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Form Controls v. ActiveX Controls
    By Richard Stringfellow in forum Excel General
    Replies: 2
    Last Post: 01-11-2016, 08:06 PM
  2. Show and Hide Label Controls based on cell on another sheet
    By muzunova in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-24-2011, 02:07 PM
  3. Form controls vs. ActiveX controls
    By wmorrison49 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2008, 10:59 AM
  4. ActiveX Controls vs Form Controls
    By Alex in forum Excel General
    Replies: 1
    Last Post: 01-11-2006, 04:50 AM
  5. [SOLVED] Hide/Show Worksheet Controls
    By John Jost in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-05-2005, 05:15 PM
  6. [SOLVED] How do I use ActiveX controls to hide/show rows on a sheet?
    By activeXhelpPlease in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2005, 05:05 PM
  7. [SOLVED] activex controls
    By Gary in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2005, 06:12 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1