Solved

Simpe simple Ms-Word Visual Basic Animation

Posted on 2000-03-27
8
256 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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 50 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

696 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