VB:Msgbox实用程序帮助测试你的vb,应该让事情变得更容易 - 更快 [英] VB: Msgbox utilities to help test your vb, should make things easier - faster
问题描述
StreamLining工作努力..
StreamLining work effort..
请注意这些msgbox示例包括一个最小化工作簿的实用程序(goMIN在底部), 对于有2个B的版本: MBB  (或msgbox b),如果你想在测试使用时留在代码页上,例如: MBB"您的文字",
否则很容易只删除常规msgbox的1 B.
note these msgbox examples include a utility to minimize the workbook (goMIN at bottom), for versions that have 2 B's: MBB (or msgbox b), if you want to stay on the code page while testing use eg: MBB "your text", else easy to just remove 1 B for regular msgbox.
如果有任何改进建议那么请做。 只有我能想到的,还没有想到的是不同msgbox版本的空格数量, 例如: 关键的, 居中 - 偏移量可能不同。
if there are any suggestions for improvement then please do. only thing i can think of, that not figured out yet would be the number of spaces for different msgbox versions, eg: critical, where centering - offset might be different.
我已经对这些使用变化进行了最佳测试, 所以他们是工作的例子。 谢谢
I have tested these as best as can for usage variations, so they are working examples. thanks
子MB(msg,可选标题为字符串) 'MSGBOX呼叫: mb"您的邮件","您的标题" (标题选项包含在以下所有内容中)
如果TITLE = vbNullString则TITLE =" Microsoft Excel" '(使用vbquestion for no ding& optional添加你自己的标题&添加空格到中心消息)
MSGBOX msg&空格(10),vbQuestion,TITLE
结束子
子MBx(msg,可选标题为字符串) "MSGBOX: 不要沉默 '打电话给: mbx"您的邮件","您的标题" '是
如果TITLE = vbNullString则TITLE =" Microsoft Excel"
MSGBOX msg&空格(10),, TITLE '注意:双字母BB表示最小化wb,在测试时留在代码页上为
结束子 注:  'title'之前的2个逗号
子MBB(msg,可选TITLE为字符串):goMIN 'MSGBOX:GOMIN 致电: mbb"您的消息" '留在代码页上
如果TITLE = vbNullString则TITLE =" Microsoft Excel"
MSGBOX msg&空格(10),vbQuestion,TITLE
结束小组
子MBY(可选标题为字符串)                'MSGBOX YES 致电: MBY  (只是结果为是,如果置于IF THEN测试中,则为true。)
如果TITLE = vbNullString则TITLE =" Microsoft Excel"
MSGBOX"是" &安培; Space(10),vbQuestion,TITLE
End Sub
子MBBY(可选作为字符串):goMIN ;       'MSGBOX YES:GOMIN
如果TITLE = vbNullString则TITLE =" Microsoft Excel"
MSGBOX"是" &安培;空格(10),vbQuestion,TITLE
结束子
$
子MBN(可选标题为字符串)                'MSGBOX NO
如果TITLE = vbNullString则TITLE =" Microsoft Excel"
MSGBOX"NO" &安培;空格(10),vbQuestion,TITLE
结束子
'mb()mbx()mbb()mby()mbby()mbn()mbbn()mbc( )mbbc() '只是快捷方式找到页面顶部(在屏幕的左侧中央放置一个快乐的小elmarko点:):
子MBBN(可选标题为字符串):goMIN          'MSGBOX NO:GOMIN
如果TITLE = vbNullString则TITLE =" Microsoft Excel"
MSGBOX"NO" &安培;空格(10),vbQuestion,TITLE
结束小计
子MBC(msg为布尔值,可选标题为字符串) 'MSGBOX CHECK (TEST yes-no out) '呼叫为:mbc test(否如果): mbc activecell.Column = 1 ':MB valA:MBC valA =" A" '是
如果TITLE = vbNullString则TITLE =" Microsoft Excel"
如果msg = True则MSGBOX为"是"。 &安培;空间(10),vbQuestion,TITLE Else MSGBOX"NO" &安培;空格(10),vbQuestion,TITLE
结束小计
子MBBC(msg为布尔值,可选标题为字符串):goMIN 'MSGBOX CHECK:GOMIN(TEST yes-no out) 'as:mbbc test(没有,如果), mbbc activecell.Column = 1 ':mbbc valA:mbbc valA =" A" b $ b 如果TITLE = vbNullString则TITLE =" Microsoft Excel"
如果msg = True则MSGBOX为"是"。 &安培;空间(10),vbQuestion,TITLE Else MSGBOX"NO" &安培;空间(10),vbQuestion,TITLE "MBBC 在代码页视图上使用(最小化工作簿:gomin)
结束子 '为所有标题固定?: MSGBOX"测试: " &安培; Space(10),vbQuestion,"OMG a a Test"&
Sub goMIN():excel.Workbooks.application.WindowState = XlWindowState.xlMinimized:End Sub    '减少工作簿视图,以便测试'消息'和& vb窗口保持排队。
'一个测试示例:
Sub MB(msg, Optional TITLE As String) 'MSGBOX call as: mb "your message", "your title" (title option included in all of below)
If TITLE = vbNullString Then TITLE = "Microsoft Excel" '(using vbquestion for no ding & optional add your own title & add space to center message)
MSGBOX msg & Space(10), vbQuestion, TITLE
End Sub
Sub MBx(msg, Optional TITLE As String) 'MSGBOX: NOT silent 'call as: mbx "your message", "your title" 'YES
If TITLE = vbNullString Then TITLE = "Microsoft Excel"
MSGBOX msg & Space(10), , TITLE 'NOTE: double letter BB indicates minimize wb, to stay on codepage while testing
End Sub 'note: 2 commas before 'title'
Sub MBB(msg, Optional TITLE As String): goMIN 'MSGBOX: GOMIN call as: mbb "your message" 'stay on code page
If TITLE = vbNullString Then TITLE = "Microsoft Excel"
MSGBOX msg & Space(10), vbQuestion, TITLE
End Sub
Sub MBY(Optional TITLE As String) 'MSGBOX YES call as: MBY (just a Yes result, for true if placed in an IF THEN test..)
If TITLE = vbNullString Then TITLE = "Microsoft Excel"
MSGBOX "YES" & Space(10), vbQuestion, TITLE
End Sub
Sub MBBY(Optional TITLE As String): goMIN 'MSGBOX YES: GOMIN
If TITLE = vbNullString Then TITLE = "Microsoft Excel"
MSGBOX "YES" & Space(10), vbQuestion, TITLE
End Sub
Sub MBN(Optional TITLE As String) 'MSGBOX NO
If TITLE = vbNullString Then TITLE = "Microsoft Excel"
MSGBOX "NO" & Space(10), vbQuestion, TITLE
End Sub
'mb() mbx() mbb() mby() mbby() mbn() mbbn() mbc() mbbc() 'just shortcuts find top of page (put a happy little elmarko dot on left center of screen :)
Sub MBBN(Optional TITLE As String): goMIN 'MSGBOX NO: GOMIN
If TITLE = vbNullString Then TITLE = "Microsoft Excel"
MSGBOX "NO" & Space(10), vbQuestion, TITLE
End Sub
Sub MBC(msg As Boolean, Optional TITLE As String) 'MSGBOX CHECK (TEST yes-no out) 'call as: mbc test (no if): mbc activecell.Column = 1 ': MB valA: MBC valA = "A" 'YES
If TITLE = vbNullString Then TITLE = "Microsoft Excel"
If msg = True Then MSGBOX "YES" & Space(10), vbQuestion, TITLE Else MSGBOX "NO" & Space(10), vbQuestion, TITLE
End Sub
Sub MBBC(msg As Boolean, Optional TITLE As String): goMIN 'MSGBOX CHECK: GOMIN (TEST yes-no out) 'as: mbbc test (no if), mbbc activecell.Column = 1 ': mbbc valA: mbbc valA = "A"
If TITLE = vbNullString Then TITLE = "Microsoft Excel"
If msg = True Then MSGBOX "YES" & Space(10), vbQuestion, TITLE Else MSGBOX "NO" & Space(10), vbQuestion, TITLE 'MBBC use on code page view (minimize workbook by: gomin)
End Sub 'FIX ALL FOR TITLE?: MSGBOX "Test: " & Space(10), vbQuestion, "OMG its a Test"
Sub goMIN(): excel.Workbooks.application.WindowState = XlWindowState.xlMinimized: End Sub 'reduce workbook view so test 'messages' & vb window stay on queue.
'one test example:
  'MBC application.WorksheetFunction.CountIf(Range(activecell.OFFSET(3,0),activecell),"。"")> 2   '是的? !!    EG OFF 4 GETS 5
'MBC application.WorksheetFunction.CountIf(Range(activecell.OFFSET(3, 0), activecell), ".") > 2 'YES ?? !! EG OFF 4 GETS 5
推荐答案
您好Davexx,
Hi Davexx,
我认为您希望提高代码的性能,我不确定我的理解是否正确。
I assume that you want to improve the performance of the code, I am not sure if my understanding is correct.
根据我的研究,这里有一些文章可以提高代码性能。
According to my research, here are some articles to improve code performance.
有关详细信息,请参阅以下链接:
For more information, please see the links as below:
希望它可以帮到你。
最好的问候,
Lina
这篇关于VB:Msgbox实用程序帮助测试你的vb,应该让事情变得更容易 - 更快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!