The information in this article applies to:
SUMMARYThe GET.WORKBOOK function will return #N/A if the name of the workbook is not specified, and if the Workbook Contents Window is not the active document when the macro executes this function. MORE INFORMATION
Page 209 of the "Microsoft Excel Function Reference" states that the
optional argument to GET.WORKBOOK, "NAME_TEXT," is the name of an open
workbook, and if omitted, is assumed to be the active workbook.
WORKAROUND
Use the Get.Document() function when trying to return the name of the
active document in a workbook. If you use the following syntax on a macro
sheet:
the name of the active document in the workbook (including the name of the workbook) will be returned to cell A1 on the macro sheet. If you would like to just extract the name of the active worksheet in the workbook (without the workbook name) use the following syntax on a macro sheet:
where "count" is a variable that contains the position of the "]" character in the string returned by the Get.Document(1) function call. The name of just the active document in the workbook should be returned to cell A2 in the macro sheet. REFERENCES
"Microsoft Excel Function Reference," version 4.0, pages 4, 209, 460
Additional query words:
Keywords : |
Last Reviewed: March 25, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |