The text box is the element on a form that allows you to enter data in the user application. You can use input from the text box in your Visual Basic for Application (VBA) procedure. An Excel VBA text box is an empty field on a worksheet that you can fill in with the text. The VBA for Excel text box control includes design properties that gives you the ability to set the font, color of the background and the type of the box border.
Click "Start," "Microsoft Visual Basic for Applications."
Enter the following code in the open window:
' Macro1 Macro
Dim chtTemp As Chart
Dim objTemp As Object
Set chtTemp = ActiveSheet.ChartObjects(1).Chart
Set objTemp = chtTemp.Shapes.AddTextbox
(msoTextOrientationHorizontal, 1, 1, 150, 20)
Selection.Formula = "='" & chtTemp.Parent.Parent.Name & "'!A1"
Click "File," "Save" to add the VBA script to your spreadsheet application.
- Photo Credit Photodisc/Photodisc/Getty Images
How Do I Create a Text Box in Excel?
A text box can easily be inserted anywhere in a Microsoft Excel 2007 worksheet. This text box can be any size or...
How To Display Values In a Textbox In Visual Basic
Text boxes in a user interface are often used to get information from the user, but they can also be used to...
How to Create a Message Box in Excel VBA
Create a message box based on visual base codes, or VBA's, in Excel by going to tools and then selecting macros. Create...
How to Create a VB6 Program for a Bar Code Scanner
Scan any bar codes you want to read and connect the scanner to your computer. Recently scanned bar codes will be placed...
How to Read a VBA Code in Microsoft Excel
VBA (Visual Basic for Applications) code is part of most of the Microsoft Office applications. Learning to read the code involves understanding...
How to Count Checked Text Boxes in an Excel Spreadsheet
Many Excel users go to great lengths to create true and false, or yes and no, types of values in the cells...
How to Add a Second Y-Axis to a Graph in Microsoft Excel
Anyone in business knows that data can help you make better business decisions. But looking at rows and columns of numbers can...
VBA Code for Auto Fill in Excel
Learning to use VBA to run Excel's AutoFill command lets you create a commonly-occurring numeric or text series with a single mouse...
How to Use VBA Codes in Excel
Visual Basic for Applications (VBA) is a programming language you can use to tailor Microsoft Office applications to fit your specific needs....