By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,327 Members | 1,806 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,327 IT Pros & Developers. It's quick & easy.

Stepping through one subroutine only in VBA

P: n/a
Hello.....

RE: Access 2003 / VBA Editor

Given the sample code:

Public Sub TestPayment()
Line 1: lngCalculated Amount = ('my large decimal calculation)
Line 2: strFileOut = gblCurrPath & gblNewFileOut
Line 3: MsgBox "Checking Amount" & vbCrLf & vbCrLf & _
"New Calculated Amount: " & Cstr(lngCalculated Amount)
& _
"located at " & strFileOut & _
, vbOKOnly + vbInformation, "Calculation Result"
Lines 4 & following: (populate a new recordset and proceed on...)
End Sub

I want to check these values and then make sure my msgbox is formatted
correctly and looks good for the user. In the VBA Editor, is there a
way I can simply step through all lines of this sub only...and
stop...then tweak my msgbox formatting and re-test this paragraph
again?

I'm not interested in stepping through any other portions of my app in
debug mode; just this paragraph only.

Thanks.
Dec 13 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<rl*********@yahoo.comwrote in message
news:6c**********************************@e6g2000p rf.googlegroups.com...
Hello.....

RE: Access 2003 / VBA Editor

Given the sample code:

Public Sub TestPayment()
Line 1: lngCalculated Amount = ('my large decimal calculation)
Line 2: strFileOut = gblCurrPath & gblNewFileOut
Line 3: MsgBox "Checking Amount" & vbCrLf & vbCrLf & _
"New Calculated Amount: " & Cstr(lngCalculated Amount)
& _
"located at " & strFileOut & _
, vbOKOnly + vbInformation, "Calculation Result"
Lines 4 & following: (populate a new recordset and proceed on...)
End Sub

I want to check these values and then make sure my msgbox is formatted
correctly and looks good for the user. In the VBA Editor, is there a
way I can simply step through all lines of this sub only...and
stop...then tweak my msgbox formatting and re-test this paragraph
again?

I'm not interested in stepping through any other portions of my app in
debug mode; just this paragraph only.

Thanks.
Sure you can. Just call it from the immediate window:

Place a breakpoint on the 1st line of the sub. Then just type TestPayment
and press enter. When the sub terminates, to test it again, in the immediate
window, put the cursor on the line you typed previously and press enter
again. And so on ad nauseam till you get it right :)
Dec 13 '07 #2

P: n/a
Your solution worked great...thank you! I appreciate it.
Dec 13 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.