Excel Button Growing

2020-07-09 10:41发布

I'm working on a workbook in Excel 2010 that someone else created (I don't know which version they were using) with a button in it that invokes a macro. There are a lot of macros defined, so I'm right-clicking on it to find out which one it calls, but the context menu doesn't appear. Instead, when I click off, the button gets larger. I can make this happen as many times in a row as I'd like. There is another button the same worksheet that has the same context menu problem, but instead of growing, the text shrinks each time. There is another button that functions normally when I do this.

标签: vba excel
4条回答
虎瘦雄心在
2楼-- · 2020-07-09 11:08

Growing buttons in Excel is a fairly common issue, with several theories about why this happens, including the use of multiple monitors or using proportional fonts. I have yet to see a definitive answer about this, but there are several workarounds that may work for you.

  1. Delete and re-create the buttons.
  2. Programmatically set the height and width of the buttons when the workbook is opened and when a button is clicked.
  3. Select the button with another object or two on the sheet and group them.
  4. Don't use them at all.

My personal choice is #4. As an alternative to buttons, I either use hyperlinks or shapes with macros assigned to them.

查看更多
地球回转人心会变
3楼-- · 2020-07-09 11:11

I have this same issue. I have two Excel workbooks with similar buttons on each. This only happens on one of them, but it happens every time I open that file.

I have found a sort of work-around. I open a blank Excel document, then I open the affected one and the buttons do not change size any more. When I open the second one, I have to drag it into the window with the already-open file. If I double-click on it, it opens in a new window and the problem remains.

查看更多
看我几分像从前
4楼-- · 2020-07-09 11:16

I have the same issue sometimes. In my case, I could replicate it 100% on one file but it was inconsistent on an virtually identical file. I also found the size error wasn't permanent -- I could save and reopen the file to restore the button's appearance. I could also create a new window and then discard the damaged window.

For me, the button resized when I accessed the sheet's HPageBreaks collection. I was able to avoid the problem by temporarily changing the window view as follows:

ActiveWindow.View = xlPageBreakPreview
  ' do pagination stuff using HPageBreaks
ActiveWindow.View = xlNormalView
查看更多
【Aperson】
5楼-- · 2020-07-09 11:17

I think you want to enter "Design Mode" in the work book: enter image description here

You should be able to right-click on the button to see what it does after that.

查看更多
登录 后发表回答