While...Wend循环中,如果条件为True,则会执行所有语句,直到遇到Wend关键字。

如果条件为false,则退出循环,然后控件跳转到Wend关键字后面的下一个语句。

语法

以下是VBA中While..Wend循环的语法。

While condition(s)
[statements ]
[statements ]
...
[statements n]
Wend

流程图

示例

参考以下示例代码的实现 -

Private Sub Constant_demo_Click()
Dim Counter : Counter = While Counter < ' Test value of Counter.
Counter = Counter + ' Increment Counter.
msgbox "The Current Value of the Counter is : " & Counter
Wend ' While loop exits if Counter Value becomes 15.
End Sub

当上面的代码被执行时,它会在消息框中打印以下内容。

The Current Value of the Counter is :  

The Current Value of the Counter is :  

The Current Value of the Counter is :  

The Current Value of the Counter is :  

The Current Value of the Counter is : 

最新文章

  1. REq,RES编码设置
  2. linux android真机测试
  3. sql 通过游标 拆分xml结构
  4. unity, 保存prefab时material丢失问题
  5. linux多线程编程(转)
  6. Javascript诞生与历史
  7. ASP.NET内置对象
  8. 学习日记-----ORM
  9. [React] Extracting Private React Components
  10. linux线程间同步方式汇总
  11. [ASP.NET]以iTextSharp手绘表格并产生PDF下载
  12. UNIX环境高级编程——非阻塞设置
  13. C# Unity的使用
  14. 后台文本编辑器KindEditor介绍
  15. 纯Css实现Div高度根据自适应宽度(百分比)调整
  16. 用Emacs看电影
  17. sgu 176 上下界网络流最小可行流带输出方案
  18. sqlserver流程控制(待续)
  19. redis的key
  20. Java接口获取系统配置信息

热门文章

  1. Flutter Navigator&amp;Router(导航与路由)
  2. Linux系统调优——网络(四)
  3. python编程中的一些有用插件或工具
  4. spring AOP的基本概念
  5. SpringBoot学习笔记:单元测试
  6. TS - 问题解决力 - 下篇
  7. 单元测试-测试技术(Unit Test)
  8. 【GStreamer开发】GStreamer基础教程14——常用的element
  9. myeclipse 相关问题
  10. [Oracle] - 使用32位 PLSQL(PL/SQL Developer)登陆64位Oracle失败之解决