Excel: the Incredible Shrinking and Expanding Controls

前端 未结 30 1926
予麋鹿
予麋鹿 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:15

    This problem is in fact due to screen resolution. Most commonly it occurs when the user connects to a projector, or WebEx while using the excel application.

    A simple solution to this problem is to ask the user to reboot their machine without any peripheral connections (projector) and then open the excel application again.

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

    This has been plaguing me for years, on and off. There are a number of fixes around, but they seem hit and miss. It was still occurring in Excel 2010 (happening to me May 2014), and is still occurring in Excel 2013 by some reports. The best description I have found that matches my situation at least (Excel 2010, no RDP involved, no Print Preview involved) is here:

    Microsoft Excel Support Team Blog: ActiveX and form controls resize themselves when clicked or doing a print preview (in Excel 2010)

    (This might not help for users of Excel 2013 sorry)

    EDIT: Adding detail in case technet link ever goes dead, the technet article says:

    FIRSTLY install Microsoft Hotfix 2598144 for Excel 2010, available: here.

    SECONDLY, if your symptom is "An ActiveX button changes to the incorrect size after you click it in an Excel 2010 worksheet", then you should:

    • Click Start, click Run, type regedit in the Open box, and then click OK.
    • Locate and then select the following registry subkey HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Options
    • On the Edit menu, point to New, and then click DWORD (32-bit) value.
    • Type LegacyAnchorResize, and then press Enter.
    • In the Details pane, right-click LegacyAnchorResize, and then click Modify.
    • In the Value data box, type 1, and then click OK.
    • Exit Registry Editor.

    OR SECONDLY, if your symptom is "A button form control is displayed incorrectly in a workbook after you view the print preview of the workbook in Excel 2010", then you should:

    • Click Start, click Run, type regedit in the Open box, and then click OK.
    • Locate and then select the following registry subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Options
    • On the Edit menu, point to New, and then click DWORD (32-bit) value.
    • Type MultiSheetPrint, and then press Enter.
    • In the Details pane, right-click MultiSheetPrint, and then click Modify.
    • In the Value data box, type 1, and then click OK.
    • Select the following registry subkey again: HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Options
    • On the Edit menu, point to New, and then click DWORD (32-bit) value.
    • Type LegacyAnchorResize, and then press Enter.
    • In the Details pane, right-click LegacyAnchorResize, and then click Modify.
    • In the Value data box, type 1, and then click OK.
    • Exit Registry Editor.

    OR SECONDLY, if your symptom is "An ActiveX button is changed to an incorrect size in an Excel 2010 worksheet after you view the print preview of the worksheet", then you should:

    • Click Start, click Run, type regedit in the Open box, and then click OK.
    • Locate and then select the following registry subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Options
    • On the Edit menu, point to New, and then click DWORD (32-bit) value.
    • Type LegacyAnchorResize, and then press Enter.
    • In the Details pane, right-click LegacyAnchorResize, and then click Modify.
    • In the Value data box, type 1, and then click OK.
    • Exit Registry Editor.

    Good luck. This issue is such a pain...

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

    I noticed that none of these answers anchor the control to a specific row and column. This has worked pretty cleanly for me as Rows/Columns tend to be more predictable than monitors' resolution.

    The below sample basically "measures" where the object should go, then sets it there in the Worksheet_Activate code. In the below example, the button will always snap to covering D8:F10.

    Private Sub Worksheet_Activate()
    'Note this is done in the sheet code, not a Module.
    
       With Me.Shapes("CommandButton1")
    
           .Left = Me.Range("A1:C1").Width
           .Top = Me.Range("a1:a7").Height
           .Width = Me.Range("D1:F1").Width
           .Height = Me.Range("A8:a10").Height
    
       End With
    
    End Sub
    

    The result will appear as shown below:

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

    I had a similar problem, however I found that it was quickly fixed by zooming the page in and out. Therefore, I added the below code onto the bottom of my Macro as a quick fix. I'm no Excel whizz but it seems to work ok. Change the bottom number should reflect your preferred zoom.

    ActiveWindow.Zoom = 100
    ActiveWindow.Zoom = 90
    
    0 讨论(0)
  • 2020-11-28 05:19

    After trying many of the solutions on this and related posts, I discovered that the solution to a different problem that Microsoft had posted also worked reliably for this particular issue when applied in a particular way, at least within the context I'm working within. I experienced these problems in a resolution native to the laptops we have here and on a PC whenever I'd switch to a non-native resolution. Namely, buttons loading at a larger than normal size, getting larger when clicked on, and text and images in these buttons shrinking (and at least the setting for the text remained the same so I couldn't see any way to change it back programmatically or otherwise.) These have not been intermittent problems in my case. I have had intermittent problems though after using print preview which Microsoft has posted a solution for here. I've tried this and it seems to be working.

    The solution: For Excel, close the app and delete the MSForms.exd file from C:\Users{UserName}\AppData\Local\Temp\Excel8.0 while in the resolution that you want to view the buttons in. You could also search for other .exd files in your local AppData\Temp folder for other Office apps.

    As I mentioned, this is a solution proposed by Microsoft for a different issue - where the buttons stop working after the Dec '14 updates are installed. Here's the link to that article. In that case, it's a one time fix. Here, you may need to do it every time you change resolutions.

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

    The fixes discussed earlier, programatically resizing/repositioning the Active X Controls after click events, or modifying the registry (with the D word LegacyAnchorResize), didn't solve the issue for me with Excel 2010/ Windows 7 64 bit.

    The solution for me was found here:https://support.microsoft.com/en-us/kb/838006

    For Excel 2010 the link instructs to:

    1. Exit all the programs that are running.
    2. Click Start, click Run, in the Open box, type regedit, and then click OK.
    3. Locate, and then click the following registry key:
    4. HKEY_CURRENT_USER\Software\microsoft\office\14.0\common
    5. On the Edit menu, point to New, and then click Key.
    6. Type Draw, and then press Enter.
    7. On the Edit menu, point to New, and then click DWORD value.
    8. Type UpdateDeviceInfoForEmf, and then press Enter
    9. Right-click UpdateDeviceInfoForEmf, and then click Modify. 10.In the Value data box, type 1, and then click OK.
    10. On the File menu, click Exit to close Registry Editor.
    0 讨论(0)
提交回复
热议问题