VBA debugging tool Debug. Print

Source: Internet
Author: User

Iamlaosong

Baidu, it is easy to find the Debug. Print explanation and usage introduction. In fact, it is very simple, that isThe code execution result is displayed in the "immediate window" without affecting program execution. VBADuring program debugging, you often need to monitor the value of a variable. Although msgbox can also complete this function, using Debug. Print to display the value of a variable or expression has many advantages, such:

1. The execution of the program is not affected. Although msgbox can also display the code execution result, you must press the OK button each time to continue. A large loop statement cannot be executed;

2. After the program debugging is completed, these debugging statements should be blocked. However, even the legacy Debug. Print does not affect the user's use, msgbox does not;

3. The biggest advantage is that the value of a variable can be studied slowly in the "immediate window" and copied out for research. For example, we want to synthesize an SQL statement, but the execution fails, where is the error? The variables and values in the program are mixed together, so it is difficult to find out the error points, especially when there are many quotation marks and parentheses. Copy the merged SQL statement and execute it to easily find the problem, msgbox does not work.

VBA debugging tool Debug. Print

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.