View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Real-time character counter

Two more points:

1. remove Steve's timing counter from the VBA
2. remember to test for some kind of excape character to know when to quit
the macro.


--
Gary''s Student - gsnu200716


"Jack_Feeman" wrote:

Thanks for the really fast answer. I will try it out.
Jack

"Gary''s Student" wrote:

All you need is a routine to capture keystrokes, append them to a string,
display the string, and finally display the count of characters in the
string. For an example of capturing the keystrokes in realtime see:

http://www.oaltd.co.uk/Excel/Default.htm

CheckKey.zip (20 Aug 1996, 8k, 14363 downloads)
This file demonstrates how to check for a key press during a lengthy looping
routine. For example, your routine could display the message "Press the space
bar to cancel this operation.". The routine could check if the space bar had
been pressed at the start of each loop. It uses Windows API calls to check
the message buffer. Both 16-bit and 32-bit versions of the routine are
included.
--
Gary''s Student - gsnu200716


"Jack_Feeman" wrote:

Excel 2003
I am trying to display a character counter in real time. Scenario:
An Excel form has a comment cell where the user types a comment.
(We all know that Excel can display 1024 characters in a cell and 32,767 in
the formula bar. When you print, Excel can only print a portion of those and
help doesn't give the exact mount).
I need to print the entire contents of a cell up to the limitaions above.
The Excel Printing group suggested that I use the =LEN(cellref) to count the
characters in the cell to give the user a warning of how many characters they
have entered. Assuming that Excel can print what it displays in the cell
(1024 characters), I amended that fomrula to =1024-LEN(cellref) which works
good but only after you leave the comment cell.
Is there a way to make the results of this counter cell real-time? (To give
a running result while the user is still in the comment cell.)
If it is not possible, I would like to add a character counter to the cell
or adjacent cell so users know how many characters they have left before the
print copy won't show them. Anyone know where or how I can get/vba a counter?

Thanks
Jack