Excel: the Incredible Shrinking and Expanding Controls

前端 未结 30 1940
予麋鹿
予麋鹿 2020-11-28 04:51

Occasionally, I\'ll happen across a spreadsheet which suffers from magic buttons or listboxes which get bigger or smaller over time.

Nothing in the code is instructi

相关标签:
30条回答
  • 2020-11-28 05:02

    Now using Excel 2013 and this happens EVERY time I extend my display while Excel is running (and every time I remove the extension).

    The fix I've started implementing is using hyperlinks instead of buttons and one to open a userform with all the other activeX controls on.

    0 讨论(0)
  • 2020-11-28 05:07

    Old thread but I was having this issue and solved it by first grouping the, in my case, option buttons together that were having the issue then simply setting (resetting) the size of this group in an Auto_Open as such:

    With ThisWorkbook
        .Worksheets("1").Shapes("grpInput").Width = 383.1
        .Worksheets("2").Shapes("grpSuite").Width = 383.1
        .Worksheets("3").Shapes("grpLoc").Width = 383.1
        .Worksheets("4").Shapes("grpDecision").Width = 383.1
    End With
    
    0 讨论(0)
  • 2020-11-28 05:07

    Grouping the controls appears to work for me. I would upvote or comment but SO won't let me. Note that this issue comes up often if you use W8 display scaling and have a high resolution laptop and older monitor.

    0 讨论(0)
  • 2020-11-28 05:08

    I've had this issue a few times and to resolve I did the following:

    1. Search through my C:\ drive for any file with the extension '.exd'
    2. Delete those files (it is okay to do so)
    3. Implement code that re-sizes the ActiveX objects each time the sheet is opened

    I found this issue was caused everything we plugged the laptop into a projector and saved the file. Then everytime the issue came up I went just repeated steps 1. and 2. and my ActiveX objects were behaving again

    0 讨论(0)
  • 2020-11-28 05:08

    i didn't test this, but i guess this has to do with the zoom property (maybe add activewindow.Zoom = false).

    Also can do a loop on shapes wich defines .Placement = xlMove on workbook_open and window_activate , this is to prevent shapes from resizing with cells (but will move with them).

    i am using excel 2013 and never had this issue, also i never use it remotely..., just trying to help with small ideas

    0 讨论(0)
  • 2020-11-28 05:10

    It's very weird. The Width & Height properties don't shrink when queried (either in code or using the properties sheet), but apparently they DO change.

    I noticed that if I use the properties sheet and change the width from the standard 15 to, say, 14 and then BACK to 15, it fixes it.

    The code below works for me (and has an amusing visual effect on the sheet: you click, it shrinks, the screen flickers, and it expands back).

    MY SOLUTION in code (on the click event for the checkbox):

    Dim myCtrl As OLEObject
    For Each myCtrl In ActiveSheet.OLEObjects
      myLab = myCtrl.Name
      myCtrl.Height = 14 ' to "wake up" the property.
      myCtrl.Height = 15 ' to reset it back to normal
      myCtrl.Width = 12 ' just making sure
    Next myCtrl
    
    0 讨论(0)
提交回复
热议问题