+ Reply to Thread
Results 1 to 11 of 11

ActiveX Controls Misbehaving on Different Screen Scales

  1. #1
    Registered User
    Join Date
    11-03-2024
    Location
    Sydney, Australia
    MS-Off Ver
    365, Version 2402
    Posts
    5

    ActiveX Controls Misbehaving on Different Screen Scales

    Hi folks!

    I created a 'tool', so to speak, in excel using various dropdown comboboxes and command buttons that generate specified data into a textbox, depending on what value is selected. The goal is to generate 'statements' based on the users selections.

    The tool works well, except for one big problem.

    I created this tool on my own work setup, with monitors that are set to 100% screen scale. It didnt occur to me that it may not function correctly on other users setups.

    When users in my team attempt to use the program on a setup that is different, e.g., laptop screen set to 150% + monitor set to 100%, the contols just start acting wild and pretty much dont work. For example, If a user on a laptop (150% screen scale) clicks a drop down, the dropdown arrow will either bounce around, get really large, or shrink etc, text will be blurry or gradually shrink to nothing.

    Is there a way to get vba to resize the controls depending on the users screen scale when opening the file, while maintaining the controls location on the page and usability?

    Ive attempted a few different codes, but so far nothing seems to be working for me.

    Any help would be massively appreciated, as I'm completely self taught when it comes to this sort of thing!

    Thank you

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

    Re: ActiveX Controls Misbehaving on Different Screen Scales

    Welcome to the Forum sadi3!

    Quote Originally Posted by sadi3 View Post
    laptop screen set to 150% + monitor set to 100%
    I have seen this happen when using an external monitor with a laptop. Not always, but that's the situation where I've seen it.

    Is there a way to get vba to resize the controls depending on the users screen scale when opening the file, while maintaining the controls location on the page and usability?
    It's possible to write VBA code to set size and location of the controls, but you have to decide what event to monitor to trigger the resize. This can get cumbersome.

    I don't think this problem exists with Forms controls, but I don't like the VBA support for them. It depends on how you're using them. Could you give more detail, or a sample file?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,425

    Re: ActiveX Controls Misbehaving on Different Screen Scales

    This has been a known problem since VBA was introduced into Office. ActiveX controls are not native controls in Excel. They were, as I say, imported “by force” from the VB5 language. As a result, for many years you have noticed strange behavior of these controls when they are embedded in a worksheet. There is no problem with them when they are embedded in a UserForm.
    If you can, use Form Controls, although they are much worse to program. The only way I've found for ActiveX controls is to constantly force a certain position and size of the controls in multiple events.

    Artik

  4. #4
    Registered User
    Join Date
    11-03-2024
    Location
    Sydney, Australia
    MS-Off Ver
    365, Version 2402
    Posts
    5

    Re: ActiveX Controls Misbehaving on Different Screen Scales

    Hi StringJazzer!

    Thank you so much for replying!

    I found the form controls too limiting, which is why i opted for ActiveX.

    sure thing, I'll attach a sample - what sort of things do you need included in the sample to review? I'm mindful that my document contains sensitive data so I will need to strip it back a bit first, but keeping the functions the same.

    I have approx 13 Dropdown Comboboxes that contain values located in cells on another worksheet. When the user selects values from each drop down and click on a 'generate' command button, text will concatenate assigned text (in vba) to a specified textbox to form a 'statetment' based on the value selections.

    Heres a screen grab: below the large image is an example of how when clicked on, the dropdown button shifts/misbehaves

    excel grab.png

  5. #5
    Registered User
    Join Date
    11-03-2024
    Location
    Sydney, Australia
    MS-Off Ver
    365, Version 2402
    Posts
    5

    Re: ActiveX Controls Misbehaving on Different Screen Scales

    Thanks Artik!

    Yes, when I initially started this project, I was using form controls, however I found they were way too restrictive (likely due the the fact that I also had no idea what I was doing )

    There is no problem with them when they are embedded in a UserForm.
    Ok, very curious, I know absolutely nothing about UserForms. If I was to recreate my tool using a userform, how would that appear? would It open onto a worksheet? Id contemplate redesigning my tool into a userform if it means it will decrease the risk of function issues for users. I have a large team of approx 30 people who work all across different sites and different workstation setups, depending on where they are working for the day. So this issue is super frustrating

  6. #6
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,425

    Re: ActiveX Controls Misbehaving on Different Screen Scales

    Looking at the screenshot shown, it seems that all the controls can be moved to UserForm.

    Artik

  7. #7
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,425

    Re: ActiveX Controls Misbehaving on Different Screen Scales

    You design UserForm in a VBA editor. From the editor menu, choose Insert/UserForm, into which you can insert the controls you need. They are programmed similarly to controls embedded in a worksheet.
    You should remember that the UserForm should be sized to fit on the computer screen with the smallest resolution used by your colleagues. At the time of designing the form (especially its appearance), you can change the screen resolution on your computer to the smallest one used by your team members, so that you have an idea of how the user will see your form. It is also possible to dynamically resize the form and its controls, but this process is already more complex.
    Calling the form can be implemented by a button placed on the sheet, to which a simple macro will be attached:
    Please Login or Register  to view this content.
    Artik

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2407
    Posts
    26,095

    Re: ActiveX Controls Misbehaving on Different Screen Scales

    Your sample looks like you are not using any cells for user input so it's a good candidate to put into a UserForm.

  9. #9
    Registered User
    Join Date
    11-03-2024
    Location
    Sydney, Australia
    MS-Off Ver
    365, Version 2402
    Posts
    5

    Re: ActiveX Controls Misbehaving on Different Screen Scales

    Hi Artik!

    Thank you so much for your help! I really appreciate it. Im now in the process of reverting my design to a userform. I was just hoping to clarify one thing:
    Please Login or Register  to view this content.
    - when you say smallest, do you mean, for example, 100% would be the smallest, and 150% would be larger? or is it the other way around?

    Thank you!

  10. #10
    Registered User
    Join Date
    11-03-2024
    Location
    Sydney, Australia
    MS-Off Ver
    365, Version 2402
    Posts
    5

    Re: ActiveX Controls Misbehaving on Different Screen Scales

    Correct, I've not used any cells at all! This makes me happy, hopefully moving it to a userform will be simple and the best solution. Thank you so much for your help!!

  11. #11
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2407
    Posts
    26,095

    Re: ActiveX Controls Misbehaving on Different Screen Scales

    The screen resolution is the pixel dimensions you have set in Windows for the display. For example, my monitor is set to 1920 x 1080. If any of your users is using a lower resolution than you, you should temporarily downgrade your resolution settings to design the form. Otherwise you may design a userform that won't fit on their screen.

    resolution.jpg

+ 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 and ActiveX Controls - Option Button
    By mmchaley in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2021, 05:10 PM
  2. Form Controls v. ActiveX Controls
    By Richard Stringfellow in forum Excel General
    Replies: 2
    Last Post: 01-11-2016, 08:06 PM
  3. ActiveX controls
    By ell123 in forum Excel General
    Replies: 1
    Last Post: 08-21-2009, 12:10 PM
  4. Form controls vs. ActiveX controls
    By wmorrison49 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2008, 10:59 AM
  5. ActiveX Controls vs Form Controls
    By Alex in forum Excel General
    Replies: 1
    Last Post: 01-11-2006, 04:50 AM
  6. VBA project and ActiveX controls
    By panatulhalie in forum Excel General
    Replies: 2
    Last Post: 06-15-2005, 07:31 AM
  7. activex controls
    By Gary in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2005, 06:12 AM

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