一个迟来的4月1日快乐的朋友。像你们大多数人一样,我一直觉得Excel缺少vba
MsgBox
例程中的Skull and Bones图形图像。坦白说,红色的vbCritical
远远不足以在用户确实做过可怕的事情时警告他们。
所以我想,足够了,我需要一个骷髅头!我的许多客户都具有专业水准,这使我无法制定定制的FORMS。因此,我不想违反任何行为准则,而是考虑了ASCII SKULLS的图形文本选项。在网上快速here搜索DuckDuck。
在这一点上,我认为我要做生意了,但是正如您在下面看到的那样,brought me some of the finest skull compilation art的MsgBox
版本还有很多不足之处!显然,这不会惊动任何人...
我怀疑问题在于我用来存储艺术品的方法(如Comment.Text
)正在以某种不良的方式格式化。有没有一种方法可以控制这种情况,或者有更好的方法将文本存储在Excel中以保留文本格式?
我的vba代码是基本的:MsgBox Range("A1").Comment.Text
还。...在SO上效果很好!
uuuuuuu
uu$$$$$$$$$$$uu
uu$$$$$$$$$$$$$$$$$uu
u$$$$$$$$$$$$$$$$$$$$$u
u$$$$$$$$$$$$$$$$$$$$$$$u
u$$$$$$$$$$$$$$$$$$$$$$$$$u
u$$$$$$$$$$$$$$$$$$$$$$$$$u
u$$$$$$" "$$$" "$$$$$$u
"$$$$" u$u $$$$"
$$$u u$u u$$$
$$$u u$$$u u$$$
"$$$$uu$$$ $$$uu$$$$"
"$$$$$$$" "$$$$$$$"
u$$$$$$$u$$$$$$$u
u$"$"$"$"$"$"$u
uuu $$u$ $ $ $ $u$$ uuu
u$$$$ $$$$$u$u$u$$$ u$$$$
$$$$$uu "$$$$$$$$$" uu$$$$$$
u$$$$$$$$$$$uu """"" uuuu$$$$$$$$$$
$$$$"""$$$$$$$$$$uuu uu$$$$$$$$$"""$$$"
""" ""$$$$$$$$$$$uu ""$"""
uuuu ""$$$$$$$$$$uuu
u$$$uuu$$$$$$$$$uu ""$$$$$$$$$$$uuu$$$
$$$$$$$$$$"""" ""$$$$$$$$$$$"
"$$$$$" ""$$$$""
$$$" $$$$"
答案 0 :(得分:2)
如评论中所述:ASCII艺术通常依赖于等距(非比例)字体,而不是现成的Msgbox
使用的字体。因此,很难甚至不可能完全使用MsgBox
工具。
但是,请改为创建自己的MsgBox
并在需要时调用它。将Courier
用作Label1
的字体(Courier是等距的)。
Option Explicit
Private Sub UserForm_Initialize()
Dim DispStr() As String
ReDim DispStr(1 To 26)
DispStr(1) = " uuuuuuu"
DispStr(2) = " uu$$$$$$$$$$$uu"
DispStr(3) = " uu$$$$$$$$$$$$$$$$$uu"
DispStr(4) = " u$$$$$$$$$$$$$$$$$$$$$u"
DispStr(5) = " u$$$$$$$$$$$$$$$$$$$$$$$u"
DispStr(6) = " u$$$$$$$$$$$$$$$$$$$$$$$$$u"
DispStr(7) = " u$$$$$$$$$$$$$$$$$$$$$$$$$u"
DispStr(8) = " u$$$$$$"" ""$$$"" ""$$$$$$u"
DispStr(9) = " ""$$$$"" u$u $$$$"""
DispStr(10) = " $$$u u$u u$$$"
DispStr(11) = " $$$u u$$$u u$$$"
DispStr(12) = " ""$$$$uu$$$ $$$uu$$$$"""
DispStr(13) = " ""$$$$$$$"" ""$$$$$$$"""
DispStr(14) = " u$$$$$$$u$$$$$$$u"
DispStr(15) = " u$""$""$""$""$""$""$u"
DispStr(16) = " uuu $$u$ $ $ $ $u$$ uuu"
DispStr(17) = " u$$$$ $$$$$u$u$u$$$ u$$$$"
DispStr(18) = " $$$$$uu ""$$$$$$$$$"" uu$$$$$$"
DispStr(19) = "u$$$$$$$$$$$uu """""""""" uuuu$$$$$$$$$$"
DispStr(20) = "$$$$""""""$$$$$$$$$$uuu uu$$$$$$$$$""""""$$$"""
DispStr(21) = """"""" """"$$$$$$$$$$$uu """"$"""""""
DispStr(22) = " uuuu """"$$$$$$$$$$uuu"
DispStr(23) = " u$$$uuu$$$$$$$$$uu """"$$$$$$$$$$$uuu$$$"
DispStr(24) = " $$$$$$$$$$"""""""" """"$$$$$$$$$$$"""
DispStr(25) = " ""$$$$$"" """"$$$$"""""
DispStr(26) = " $$$"" $$$$"""
Me.Label1.Caption = Join(DispStr, vbNewLine)
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
您显然可以自己进行格式化以获得所需的最终结果