Iterating unregistered add-ins (.xla)

后端 未结 6 1581
灰色年华
灰色年华 2020-12-31 13:17

I need help in

  • figuring out how to iterate through currently open Excel add-in files (.xla) that have not been registered in Excel using the Too
6条回答
  •  执念已碎
    2020-12-31 13:35

    Use =DOCUMENTS, an Excel4 macro function.

    Dim Docs As Variant
    Docs = Application.Evaluate("documents(2)")
    

    Here's the documentation for it (available here):

    DOCUMENTS
    Returns, as a horizontal array in text form, the names of the specified open workbooks in alphabetic order. Use DOCUMENTS to retrieve the names of open workbooks to use in other functions that manipulate open workbooks.

    Syntax
    DOCUMENTS(type_num, match_text)
    Type_num is a number specifying whether to include add-in workbooks in the array of workbooks, according to the following table.

    Type_num       Returns
    1 or omitted   Names of all open workbooks except add-in workbooks
    2              Names of add-in workbooks only
    3              Names of all open workbooks
    

    Match_text specifies the workbooks whose names you want returned and can include wildcard characters. If match_text is omitted, DOCUMENTS returns the names of all open workbooks.

提交回复
热议问题