Working with Strings
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Data structures composed of a sequence of alphanumeric characters, strings are basic in concept, but getting the information you require from them can be a different story.
In This Section
- Comparing Strings
Compare strings to determine whether they contain equivalent characters and how they differ if they do not match. - Calculating String Length
Determine the length of a string using the Len function to parse its contents. - Searching a String
Search strings to find out whether they contain a particular character or group of characters by using the InStr or InStrRev functions. - Returning Portions of a String
Learn how to parse the string to be able to work with part of a string's contents. - Working with Strings as Arrays
Quickly turn once-lengthy string-manipulation procedures into just a few lines of code. - Finding and Replacing Text Within a String
Find and replace all occurrences of a substring within a string using the Replace function. - Converting Text in a String from One Case to Another
Use the Microsoft® Visual Basic® for Applications (VBA) StrConv function to convert text in a string from one case to another. - Working with String Variables
Understand how to dimension a variable, assign a value to it, and output that variable as part of a string.
Related Sections
- Getting the Most Out of Visual Basic for Applications
Write code that is fast, efficient, easy to read and maintain, and, if possible, reusable with a solid working knowledge of Microsoft® Visual Basic® for Applications (VBA) — what features the language includes and what you can do with it. - Working with Numbers
Learn how to use numeric values and data types in Microsoft® Visual Basic® for Applications (VBA). - Working with Dates and Times
Manipulate date values in Microsoft® Visual Basic® for Applications (VBA), and understand how VBA stores date values internally. - Working with Files
Understand the Microsoft Scripting Runtime object library, and work with drives, folders, and files as objects. - Understanding Arrays
Use arrays when you must store a number of values of the same type, but you don't want to create individual variables to store them all. - Tips for Defining Procedures in VBA
Define a Function or Sub procedure, and use the options available to you to make your code more extensible or more flexible. - Optimizing VBA Code
Understand how to streamline your Microsoft® Visual Basic® for Applications (VBA) code to streamline your memory requirements.