Tutorial by Examples

Const appName As String = "The App For That"
Dim surname As String 'surname can accept strings of variable length surname = "Smith" surname = "Johnson"
'Declare and assign a 1-character fixed-width string Dim middleInitial As String * 1 'middleInitial must be 1 character in length middleInitial = "M" 'Declare and assign a 2-character fixed-width string `stateCode`, 'must be 2 characters in length Dim stateCode As String * 2 stateC...
'Declare, dimension and assign a string array with 3 elements Dim departments(2) As String departments(0) = "Engineering" departments(1) = "Finance" departments(2) = "Marketing" 'Declare an undimensioned string array and then dynamically assign with 'the results...
VBA offers a Mid function for returning substrings within a string, but it also offers the Mid Statement which can be used to assign substrings or individual characters withing a string. The Mid function will typically appear on the right-hand-side of an assignment statement or in a condition, but ...
Strings can be assigned directly to byte arrays and visa-versa. Remember that Strings are stored in a Multi-Byte Character Set (see Remarks below) so only every other index of the resulting array will be the portion of the character that falls within the ASCII range. Dim bytes() As Byte Dim exampl...

Page 1 of 1