VSCode VBA Snippets:提升Visual Basic开发效率的代码片段
在Visual Studio Code中,VBA Snippets为Visual Basic开发者提供了一套高效的代码片段工具,支持多种文件格式,包括.vb、.brs、.vbs和.bas。通过简单的设置,您可以快速访问并使用这些代码片段,极大地提升您的开发效率。
支持的语言和文件格式:
- Visual Basic (".vb", ".brs", ".vbs", ".bas")
使用方法:
安装此代码片段后,请在您的设置中添加以下内容:
"editor.snippetSuggestions": "top",代码片段概览:
基础代码
- Dim
- If Else
- 循环
- Sub
- Function
- Select Case
- MsgBox
详细代码片段
Dim [Dim 声明]
Dim arr()
Dim bol As Boolean
Dim lng As Long
Dim dbl As Double
Dim str As String
Dim obj As Object
PrivateIf [If 代码块]
If condition Then
End IfIfElse [If Else 代码块]
If condition Then
Else
End IfIfElseIf [If ElseIf Else 代码块]
If condition1 Then
ElseIf condition2 Then
Else
End IfWith [With 代码块]
With
End Withfor [For Next 循环]
For i = lower To upper
Next iForEach [For Each]
For Each variable In collection
Next variableDoLoopWhile [Do Loop While 代码块]
Do
Loop While conditionDoWhile [Do While 循环代码块]
Do While condition
LoopWhile [While Wend 代码块]
While condition
WendSub [Sub 代码块]
Private Sub func(input)
'
' descrip.
'
' @since 1.0.0
' @param {type} [name] descrip.
' @return {type} [name] descrip.
' @see dependencies
'
End SubFunction [Function 代码块]
Private Function func(input)
'
' descrip.
'
' @since 1.0.0
' @param {type} [name] descrip.
' @return {type} [name] descrip.
' @see dependencies
'
End FunctionSelectCase [Select Case 代码块]
Select Case test
Case lists
statements
Case Else
elseStatement
End SelectMsgBox [消息框代码块]
MsgBox "message", buttonType, "title"Cells
Range(Cells(), Cells())Range
Cells()Worksheets
Worksheets("")简短代码片段
UBound
LBound
To
Fix
Int
ReDim
Set
Call
Split
Preserve
Option Explicit
On Error Resume Next
ClearContents
Clear
Columns
Rows
CreateObject
IsEmpty通过使用VSCode VBA Snippets,您可以更快地编写和调试Visual Basic代码,提高开发效率。
