To make the moving letters, you have to create a form as figure:
The form has only one label control. To create the form, you have to follow the steps:
- Create a form in Form Design
- Drag and drop a Label control on the form.
- Set Name and Caption property Label control:
Caption: World Best Learning Center
Note: For a form have only one control, you can set or not set the control name. It's up to you. But if the form have more than one control, you should set the control name. It is easy for you when you call the control to use.
The following VBA code below explicates the example.
Option Compare Database
Dim ml As Integer
Private Sub Form_Load()
lblWBLC.FontSize = 30
TimerInterval = 500
ml = 0
Private Sub Form_Timer()
If ml < Me.Width / 2 Then ' If ml is less than the haft length of form
lblWBLC.Move ml ' then move the phrase world best learning center
ml = ml + 500 ' Set the length of moving is equal to 500 for each moving
ml = 0
' Random the fore color of the caption label(World Best Learning Center)
lblWBLC.ForeColor = RGB(88 + (Rnd() * 155), 10 + (Rnd() * 255), 0)
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: