VBA Active-X按钮在每次操作时都会变大 [英] VBA Active-X buttons getting bigger with every action

查看:120
本文介绍了VBA Active-X按钮在每次操作时都会变大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个Active-X按钮的Excel工作表.每当我单击一个按钮/执行一个动作时,每个动作的按钮都会变得越来越大.

I have an Excel sheet containing multiple Active-X buttons. Whenever I click on a button/perform an action, the buttons will keep getting bigger with every action.

最初,这不是在我的办公桌上发生的(有两个大屏幕的笔记本电脑放在码头上),但是当我仅在笔记本电脑上移动并使用该程序时,它突然开始发生.我发现的唯一解决方法是将位置正确固定在代码中.我觉得必须要有解决办法.

Initially this didn't happen at my desk (laptop in dock with two big screens), but when I moved and used the program just on my laptop, it suddenly started happening. The only fix I found is to hard-wire the positions right in the code. I feel that there has to be a solution.

下面是我的代码示例.

Private Sub SpinButton1_SpinDown()

Dim myCell As Range
Dim myRange As Range
Set myRange = Selection


SpinButton1.Height = 45
SpinButton1.Width = 39
SpinButton1.Left = 283.5
SpinButton1.Top = 328.5

For Each myCell In myRange
    myCell.Value = myCell.Value - 1
Next myCell


End Sub

推荐答案

在某些版本的Office中,这是Microsoft的错误.不能100%确定您的版本是否受到影响,但是您可以在此处进行检查: http://support.microsoft.com/kb/2598259

It is a Microsoft bug in some versions of Office. Not 100% sure if your version is affected, but you can check here: http://support.microsoft.com/kb/2598259

此修复程序也可以从那里下载.

The fix is also available for download from there.

此外,建议不要使用ActiveX按钮,除非您想制作带有精美装饰的彩色按钮.即使这样,您也可以使用

Also, it is not advisable to use ActiveX buttons unless you want to make colorful buttons with fancy decorations. Even then you can replicate the same effect using

  • 看起来像您想要的按钮的图像(带有阴影,并且全部用于3D效果)
  • 设置MouseOver工具提示以获取按钮的正确外观和字段
  • 为点击行为等分配宏.

这篇关于VBA Active-X按钮在每次操作时都会变大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆