【问题标题】:filename error in online version of excel 365在线版excel 365文件名错误
【发布时间】:2022-11-12 11:13:28
【问题描述】:

我有一个我一直在 Excel 365(版本 2209 Build 15629.20208)中处理的电子表格,我刚刚将其上传到共享点空间,以便其他人现在可以使用它。当我打开电子表格时,以下公式出现错误,该公式获取工作表名称 -

=MID(CELL("filename",K1),FIND("]",CELL("filename",K1))+1,255)

错误是:此公式中使用的值的数据类型错误。

sharepoint 中的 excel 构建显示为 16.0.15825.42300。

任何想法为什么会发生此错误?

【问题讨论】:

  • 您不能在 Excel 的在线版本中使用 CELL("filename"。它只是行不通。
  • 有没有不同的方法来获取工作表名称?
  • 点击链接CELL()读取 info_type 值,其中文件名显示它指出 "filename" Filename (including full path) of the file that contains reference, as text. Returns empty text ("") if the worksheet that contains reference has not yet been saved. Note: This value is not supported in Excel for the web, Excel Mobile, and Excel Starter.
  • @Rory 哇....每天都在学习新事物。感谢分享。
  • @AutomationMonkey 你也许可以用办公脚本做一些事情,但我不确定。

标签: excel excel-formula


【解决方案1】:

在线版本不支持 CELL(),但您可以使用 VBA。

  • 打开VBA 点击ThisWorkBook -> Insert -> Module,复制下面的代码并保存。

Function TabName()

    TabName = ActiveSheet.Name

End Function

Function GetBook() As String

  GetBook = ActiveWorkbook.Name

End Function

关闭 VBA 窗口并返回工作簿。

选择一个空白单元格,键入 =GetBook() 以获取工作表名称或 =TabName() 以获取工作簿选项卡名称。

注意:Excel 文件必须保存为“Excel Macro-Enable”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多