有什么方法可以在 vb 或 vba 中对齐消息框中的文本吗?
有什么方法可以将VB或VBA中的msgbox
中的文本对齐到中心吗? VB 有没有类似的功能?
Is there any way to align text into the center in msgbox
in VB or VBA? Does VB have any functionality to do the same?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您可能可以在消息框中使用 vbtab 和 controlchars.CrLf 的组合。
you probably can use a combinatrion vbtab and controlchars.CrLf in the message box.
将 Application.Input 框“居中”很容易:当该框打开时,用鼠标将框移动到您希望它将来打开的位置,它就可以做到这一点。它会在您上次放置的位置打开。至少如此;它对我有什么作用。
It is easy to "center" an Application.Input box: When the box opens, with the mouse move the box where you want it to open in the future and it does just that. It opens where you last position it. At least that; what it does for me.
MsgBox([Put Your Text Here], MsgBoxStyle.Information & MessageBoxOptions.RightAlign)
I Trid 及其工作
MsgBox([Put Your Text Here], MsgBoxStyle.Information & MessageBoxOptions.RightAlign)
I Trid and Its Work
不。
MsgBox()
函数只是 WindowsMessageBox()
函数,因此对图标之外的对话框没有风格控制。如果您想对其进行进一步更改,则需要创建自己的窗口并显示它。
在 Windows Vista+ 上,您可以使用 TaskDialogs 允许更多的控制。
No. The
MsgBox()
function is simply a wrapper for the WindowsMessageBox()
function and as such has no stylistic control over the dialog beyond the icon.If you want to change it any further than this, you will need to create your own window and show that instead.
On Windows Vista+ you can use TaskDialogs that allow a lot more control.
不,但你可以通过使用空格来作弊。
no, but you can cheat by using spaces.
当您构建字符串时,您可以在它们的开头和结尾处填充空格以达到目标长度。如果您使用 Excel,则工作表函数 rept 对此非常方便。
如前所述,如果消息框仍然看起来不太好,您可以使用文本框形状对象(或其他对象)来获得所需的效果。
When you are building your strings you could pad them at the beginning and end with spaces to achieve a target length. If you're using excel the worksheet function rept is handy for this.
As mentioned before if the msgbox still doesn't look good you can use textbox shape object (or other objects) to get the desired effect.
VBA
一些注释: http://access.mvps.org/access/bugs/bugs0035.htm 和 http://www.tek-tips.com/viewthread.cfm?qid=435428 不过,构建自己的消息框并不是那么困难,它可以解决您的所有问题。
VBA
Some notes: http://access.mvps.org/access/bugs/bugs0035.htm AND http://www.tek-tips.com/viewthread.cfm?qid=435428 However, it is not so difficult to build your own message box, which solves all your problems.