Finance

Charts

Statistics

Macros

Search

Label in Excel VBA

The Label control is used to display text captions — for example, titles for controls that do not have a Caption property.

The user cannot change the text displayed in a label during program execution.

The main property of the Label is Caption, which sets the text displayed inside it.

Example: Different Types of Labels

The following example demonstrates different types of labels:

  • a simple label,
  • a label with a picture,
  • a label with a border,
  • and a label with word wrapping.

Steps to implement the project:

  • Create a form and place three labels on it.
  • Prepare an image file. In this case: D:\flags.jpg.
  • In the form module, type the code, which will set the label parameters during form initialization.

Key Properties of Label

  • Picture → loads an image into the label.
  • PicturePosition → defines the relative position of the image and the text.
  • BorderStyle → specifies whether the label is displayed with or without a border.
0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx