如何让UserForm启动时listbox1中的水平滚动条向右移动?

问题描述 投票:0回答:1

我在 vba 中使用 userForm,并且有一个列表框 我将用户窗体的方向更改为从右到左,现在我想让水平滚动条在用户窗体启动时向右。我尝试了很多代码,但它不起作用。

enter image description here

enter image description here

在此输入图像描述 在此输入图片描述

excel vba office365
1个回答
0
投票

这对我有用,但无法在 365 中测试。

重要的是文本结尾不能是 CR/LF,因为这会将光标设置到第一个位置。

Private Sub UserForm_Initialize()
Me.RightToLeft = True
text1 = "Here you can place any text only to check the final result" & Chr(10) & "of the position of the scroll bar" & Chr(10)
text2 = text1 & "Here you can place any text only to check the final result" & Chr(10) & "Here you can place any text only to check the final result" & Chr(10)
Me.TextBox1.Text = text2 & "Here you can place any text only to check the final result" & Chr(10) & "Here you can place any text only to check the final resultHere you can place any text only to check the final result"  'no CR/LF at the end.

End Sub


enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.