Solved

Simpe simple Ms-Word Visual Basic Animation

Posted on 2000-03-27
8
248 Views
Last Modified: 2013-11-25
This is hardly even animation.

Say I have a form, "frmFormTitlePage".
Say I have a label on that form, "lblTitle"

I would like to have the text on lblTitle.caption to change colors every other second.  I've tried doing this numerous times by using a TIMER but I can't seem to get it right.  I know the color codes (RGB etc..) so it's not a problem in that area.  Ideas?

-rick, detroit
0
Comment
Question by:saksafon
8 Comments
 
LVL 3

Expert Comment

by:Lewy
Comment Utility
Do you have a DoEvents after changing the color?
0
 
LVL 14

Expert Comment

by:mcrider
Comment Utility
You are most likely not refreshing the control after you change the color... try this...

Add a label called "Label1" to a new project.

Add a Timer called "Timer1" to the project.

Set Timer1's Interval property to 2000 and Enabled property to TRUE.

Put the following code in the Timer1 event:

Private Sub Timer1_Timer()
    Dim iVal As Integer
    iVal = Val(Label1.Tag)
    iVal = iVal - 1
    If iVal = -1 Then iVal = 15
    Label1.ForeColor = QBColor(iVal)
    Label1.Refresh
    Label1.Tag = CStr(iVal)
End Sub

Run the program... This is just an example of changing the label's color... It runs through all 16 QBColors...


Cheers!®©

0
 
LVL 14

Expert Comment

by:mcrider
Comment Utility
Lewy, You don't need to use doevents... It's a dangerous call that can get you into alot of trouble if you don't use it properly...


Cheers!®©
0
 

Author Comment

by:saksafon
Comment Utility
"Add a Timer called "Timer1" to the project.
Set Timer1's Interval property to 2000 and Enabled property to TRUE. "

Is this a VB thing?  I'm using Word VB and I don't know if I have access to this.  Where would I find a timer and how would I place it and change settings?  I'll keep looking but I don't know if I have the ability to add one.. hmm!

rick


0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Expert Comment

by:SirNick
Comment Utility
In the past the way I have done this is

Private sub timer1_timer()
   lbltitle.forecolor = qbcolor(rnd*15)
end sub

I hope this helps..
0
 
LVL 32

Accepted Solution

by:
bhess1 earned 50 total points
Comment Utility
To get a timer on your form:

Right Click on your toolbar, and choose "Additional Controls".  Scroll down until you find the Timer Object reference, then click the check box next to it.  Click OK.

Your toolbar now has a clock-like object on it.  Select it, and draw it on your form.

In the Properties of the timer control, change the Interval property to the number of milliseconds between times you want it to run (1000 ms = 1 second).

Set Visible to false, and Enabled to true.

Double click the timer control, and you should get the _Timer event code block (probably IETimer1_Timer().  Put your color changing code in there.

Now, when you have the form up, every second, the IETimer1_Timer code will be executed, changing the color of the text.
0
 

Author Comment

by:saksafon
Comment Utility
Adjusted points from 30 to 50
0
 

Author Comment

by:saksafon
Comment Utility
Wow.. I didn't even know "additional controls" existed.  'ah I'm just a hack.

Thanks

rick
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now