?
Solved

Simpe simple Ms-Word Visual Basic Animation

Posted on 2000-03-27
8
Medium Priority
?
260 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 3

Expert Comment

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

Expert Comment

by:mcrider
ID: 2661389
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
ID: 2661401
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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:saksafon
ID: 2661426
"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
 
LVL 3

Expert Comment

by:SirNick
ID: 2661515
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:
Brendt Hess earned 200 total points
ID: 2662017
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
ID: 2663857
Adjusted points from 30 to 50
0
 

Author Comment

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

Thanks

rick
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

801 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