Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/107904

From BetaArchive Wiki

Microsoft Knowledge Base

Excel: GET.DOCUMENT() Macro Error with Numbered Filenames

Last reviewed: June 30, 1997
Article ID: Q107904

The information in this article applies to:

  • Microsoft Excel for Windows, versions 4.0, 4.0a
  • Microsoft Excel for the Macintosh, version 4.0

SUMMARY

When you concatenate the result from the macro command GET.DOCUMENT(1) within a SELECT() statement to select a range on an active sheet, you will receive a macro error if the GET.DOCUMENT(1) statement returns a filename beginning with a number.

MORE INFORMATION

Steps to Reproduce Problem

  1. Enter the following in a macro sheet.

    A1: Numname_macro A2: =SELECT(INDIRECT(GET.DOCUMENT(1)&"!A1:B2",TRUE)) A3: =RETURN()

  2. Select cell A1 and choose Formula and Define Name.
  3. Define the macro as a command macro.
  4. Save a new worksheet as 1043.XLS.
  5. Activate the new sheet and run the above macro by choosing Run from the Macro menu and selecting Numname_macro.

A macro error will occur at macro cell A2.

To fix the above macro command, make these changes: insert quotation mark, apostrophe, quotation mark, ampersand after the second open parenthesis; add apostrophe before the exclamation point. The modified code should now match the line below.

   =SELECT(INDIRECT("'"&GET.DOCUMENT(1)&"'!A1:B2",TRUE))
   =RETURN()

Additional query words: 4.00 3.00 3.00a

Keywords : kbmacro kbprg kbprg
Version : 4.00 4.00a | 4.00
Platform : MACINTOSH WINDOWS


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: June 30, 1997
©1997 Microsoft Corporation. All rights reserved. Legal Notices.