+ Reply to Thread
Results 1 to 8 of 8

Flashing text in a text Box

  1. #1
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Flashing text in a text Box

    I want a text in a textbook to be flashing. I figured out that it works better by making the textbox background color change.

    Tried the follwoing code : (be advised, this flashing is a part of a larger macro that calculates the gear forces. I wanted the program to flash the contents of the textbox at the end . Hence I inseretd the following twoards the end of my code
    HTML Code: 
    Result :
    • Didnt work or produce the anticipated results
    • I tried something in the lines of whats explained on link http://www.vbforums.com/showthread.p...-in-two-colors
    • But cant use it as it has a dedicated code starting
      HTML Code: 
    • My case, the program does other calculations and towards the end highlights some important text in the toolboxes

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Flashing text in a text Box

    See if Chip Pearson's website helps:
    http://www.cpearson.com/excel/BlinkingText.aspx
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Flashing text in a text Box

    Quote Originally Posted by Ron Coderre View Post
    See if Chip Pearson's website helps:
    http://www.cpearson.com/excel/BlinkingText.aspx
    Hello, Thanks for getting back... I browsed thru and saw that its for a Cell Range in a worksheet. However, in my prgram, non of the values are copied onto any worksheet.

    I am wanting to highlight a textbox in a userform.

    Thanks,

    Subbby

  4. #4
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: Flashing text in a text Box

    I tried something in the lines of whats explained on link...
    That link is for Classic VB. VBA does not have Timer controls which that uses.

    Flashing text is an annoyance in any case. Just highlight the control text rather than have it flashing.
    Last edited by grimes0332; 02-02-2016 at 11:01 AM.

  5. #5
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Flashing text in a text Box

    okay ! I didnt realize that until you said. Thanks for that...

    But I have used time controls in VBA. infact the former part of this code does. Have used the following

    HTML Code: 
    in my code.

    and the code I tried
    HTML Code: 
    does switch at times but is not continuous

    Any thoughts?
    Last edited by subbby; 02-02-2016 at 11:11 AM.

  6. #6
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: Flashing text in a text Box

    used time controls in VBA
    Sorry, but you haven't. A Timer control in Classic VB is a control (much like a TextBox) added to a form. It has an 'Interval' property which runs code in the Event Handler for the control every time it fires.

    In VBA there is a Timer object, not the same thing. You can store the value of the Timer and, later, compare with the current Timer value to see how long a procedure took to run, but there in no 'repeat' facility for the Timer Object - you have to use the OnTime statement to run a procedure at a particular time and then set another OnTime in that procedure to run again...

    Splitting hairs, perhaps, but the Timer control would be very useful in VBA.

  7. #7
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Flashing text in a text Box

    so its not possible ,what I am asking for ?

  8. #8
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: Flashing text in a text Box

    I didn't say it couldn't be done, just that it couldn't be done using a Timer control as you mentioned.

    VBA has the OnTime Method. This sets up a procedure to run at a particular time. The problem is it's a one-off. To repeat the procedure you have to set another OnTime in the procedure for it to run again.

    So, you could set up a procedure to change the textbox to White on Red. In that procedure you check the current Fore/Back colours and flip them. If the back color is currently Red then set to White (or whatever the standard background coloiur is), if White then set to Red. Same for the forecolor property.

    It's messy, awkward to use and not very good. You need to cancel any pending OnTime statements at some stage as Excel will 'remember' it has to run a procedure even if you unload the workbook - If you have, the workbook will be loaded again so you have to store the next time the procedure is to run and use that to cancel it.

    See this page for some more details but you are better off forgetting about flashing the textbox contents, in my opinion.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. pulsing or flashing text box
    By maurits60 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2016, 09:37 PM
  2. [SOLVED] flashing text
    By laduk in forum Excel General
    Replies: 7
    Last Post: 01-04-2013, 10:28 AM
  3. Flashing Text
    By Sordini in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2008, 11:25 AM
  4. Flashing or Scrolling Text
    By djfatboyfats in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2007, 03:54 AM
  5. Flashing or Scrolling Text
    By djfatboyfats in forum Excel General
    Replies: 0
    Last Post: 08-28-2007, 08:23 PM
  6. Flashing Text
    By JohnHill in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-01-2005, 11:19 PM
  7. Flashing Text or message
    By TonyKA in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2005, 09:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1