Returning More than 255 Characters from a Text Box or Button

Last reviewed: November 3, 1994
Article ID: Q74386
The information in this article applies to:
  • Microsoft Excel for Windows, versions 3.0, 4.0
  • Microsoft Excel for OS/2 version 3.0

SUMMARY

There is a limit of 255 characters that can be returned using the GET.OBJECT macro function with a Type_num argument of 12. If you attempt to retrieve more than 255 characters with this function, a #VALUE! error is returned. The macro in the example below allows you to retrieve more than 255 characters.

MORE INFORMATION

The form of the GET.OBJECT function is:

   =GET.OBJECT(type_num,object_id_text,start_num,count_num)

For example, the following

   =GET.OBJECT(12,"Text 1",1,20)

will return the first 20 characters from TextBox 1. The maximum value that the count_num argument can take on is 255. The example below enables you to extend this maximum.

Example

A1: =FOR("counter",1,MaxNum,255) A2: =GET.OBJECT(12,"Text 1",counter) A3: <perform some action with text here> A4: =NEXT() A5: =RETURN()

In cell A1 of the macro above, "MaxNum" should be the number of characters that you would like to retrieve. Each time the loop is executed, 255 characters are returned. The starting position for the characters to be returned changes from 1 to 256 to 511 and so on. The count_num argument can be omitted from the GET.OBJECT function because it defaults to 255.

REFERENCES

"Function Reference," version 4.0, pages 154, 202

"Microsoft Excel Function Reference," version 3.0, pages 79, 112


KBCategory: kbusage
KBSubcategory:

Additional reference words: 3.0 3.00 4.0 4.00 5.00


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 3, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.