VSCode VBA Snippets
Supported languages (file extensions)
- Visual Basic (".vb", ".brs", ".vbs", ".bas")
Usage
After install this snippets add this inside your settings
"editor.snippetSuggestions": "top",
Snippets
Basic code
- Dim
- If Else
- Loops
- Sub
- Function
- SelectCase
- MsgBox
Dim [Dim declaration]
Dim arr()
Dim bol As Boolean
Dim lng As Long
Dim dbl As Double
Dim str As String
Dim obj As Object
Private
If [If code block]
If condition Then
End If
IfElse [If Else code block]
If condition Then
Else
End If
IfElseIf [If ElseIf Else code block]
If condition1 Then
ElseIf condition2 Then
Else
End If
With [With code block]
With
End With
for [For Next Loop]
For i = lower To upper
Next i
ForEach [For Each]
For Each variable In collection
Next variable
DoLoopWhile [Do Loop While code block]
Do
Loop While condition
DoWhile [Do While Loop code block]
Do While condition
Loop
While [While Wend code block]
While condition
Wend
Sub [Sub code block]
Private Sub func(input)
'
' descrip.
'
' @since 1.0.0
' @param {type} [name] descrip.
' @return {type} [name] descrip.
' @see dependencies
'
End Sub
Function [Function code block]
Private Function func(input)
'
' descrip.
'
' @since 1.0.0
' @param {type} [name] descrip.
' @return {type} [name] descrip.
' @see dependencies
'
End Function
SelectCase [Select Case code block]
Select Case test
Case lists
statements
Case Else
elseStatement
End Select
MsgBox [Message box code block]
MsgBox "message", buttonType, "title"
Cells
Range(Cells(), Cells())
Range
Cells()
Worksheets
Worksheets("")
Short Snippets
UBound
LBound
To
Fix
Int
ReDim
Set
Call
Split
Preserve
Option Explicit
On Error Resume Next
ClearContents
Clear
Columns
Rows
CreateObject
IsEmpty