Trying to understand the basic syntax for Visual Basic for Word.

Coates, Donald 0 Reputation points
2026-10-14T20:29:39.27+00:00

What does the text vb stand for before some commands?

Developer technologies | Visual Basic for Applications
0 comments No comments

3 answers

Sort by: Most helpful
  1. Brian Pham (WICLOUD CORPORATION) 650 Reputation points Microsoft External Staff Moderator
    2026-10-15T02:52:18.22+00:00

    Hi @Coates, Donald ,

    Thanks for your question.

    In Word VBA (Visual Basic for Applications), the prefix vb stands for Visual Basic and is used for built-in constants provided by the VBA language. These constants make code easier to read and understand.

    For example:  MsgBox "Hello", vbInformation

    Here, vbInformation tells VBA to display an information icon in the message box.

    Other common examples include:

    • vbYesNo: Displays Yes and No buttons
    • vbYesNo: Displays Yes and No buttons
    • vbOKCancel: Displays OK and Cancel buttons
    • vbCrLf: Inserts a new line
    • vbTab: Inserts a tab character
    • vbTrue: Boolean True
    • vbFalse: Boolean False

    Example: Selection.TypeText "Line 1" & vbCrLf & "Line 2"

    In this case, vbCrLf creates a line break between the two lines of text.

    So, whenever you see a term beginning with vb, it is typically a predefined Visual Basic constant rather than a command or a variable.

    I hope this helps clarify the syntax you're seeing in VBA.

    If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation. Thank you.

    Was this answer helpful?

    0 comments No comments

  2. Marcin Policht 110.5K Reputation points MVP Volunteer Moderator
    2026-10-14T20:44:19.2466667+00:00

    If you see vb before a command or value, it often refers to a built-in VBA constant or enumeration. For example, vbCrLf represents a carriage return followed by a line feed, which creates a new line in text. vbTab represents a tab character, and vbYesNo specifies a Yes/No button combination in a message box.


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    Was this answer helpful?


  3. AI answer

    2026-10-14T20:29:51.0833333+00:00

    vb is used as a prefix on some built-in Visual Basic constants. In the provided examples, vbExclamation is used as the value for the Buttons argument of MsgBox.

    Example:

    MsgBox Prompt:="Hello " & myVar, _
        Title:="Greeting Box", _
        Buttons:=vbExclamation
    

    So when vb appears before a name like vbExclamation, it identifies a predefined Visual Basic value rather than text to invent or replace.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.