excel-vba-userform-frame-设置滚动条位置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15192502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 19:51:36  来源:igfitidea点击:

excel - vba - userform - frame - set scrollbar position

excelexcel-vbascrollbarexcel-2010userformvba

提问by ramtoo

How do I set the scrollbar position of a frame(inside an userform)?

如何设置框架的滚动条位置(在用户窗体内)?

The case:

案子:

I have a frame in an userform that has dynamic content. So if the content is too big to fit the frame, it (dynamically) creates a scrollbar in that frame. The scrollbar also has dynamic values, following the frame content size.

我在用户窗体中有一个具有动态内容的框架。因此,如果内容太大而无法适应框架,它会(动态地)在该框架中创建一个滚动条。滚动条也有动态值,跟随框架内容的大小。

The code that updates the scrollbar is as follows:

更新滚动条的代码如下:

With userform1.frame1
    'dynamic size
    .ScrollHeight = param1 * param2
    .ScrollWidth = .InsideWidth * 30
End with

So I'd like to have something to send the scrollbar to the bottom position! How do I do that? Thanks in advance

所以我想要一些东西将滚动条发送到底部位置!我怎么做?提前致谢

回答by barrowc

After setting the ScrollHeight and ScrollWidth and still inside the Withblock try:

设置 ScrollHeight 和 ScrollWidth 后仍然在With块内尝试:

.Scroll ActionX:=fmScrollActionNoChange, ActionY:=fmScrollActionEnd

.Scroll ActionX:=fmScrollActionNoChange, ActionY:=fmScrollActionEnd

More details can be found here

可以在此处找到更多详细信息