简体   繁体   English

Excel 2016 vba 编辑器,无法打开 ThisWorkbook 模块

[英]Excel 2016 vba editor, cannot open ThisWorkbook module

I have an Excel 2016 file (.xlsm).我有一个 Excel 2016 文件 (.xlsm)。 After few weeks working on this file, now I'm facing with one small but weird problem - cannot open ThisWorkbook module.在处理这个文件几周后,现在我面临一个小而奇怪的问题 - 无法打开 ThisWorkbook 模块。 As you can seen in the picture, trying to open this module, window just simply freezes on the screen, any mouse's single or double-clicks on it have no effect.正如你在图片中看到的,试图打开这个模块,窗口只是简单地冻结在屏幕上,任何鼠标单击或双击都没有效果。

Maybe somebody also had the same issue?也许有人也有同样的问题? What might cause it and how to resolve it?什么可能导致它以及如何解决它?

此工作簿模块冻结在屏幕上

this might have only worked for me but is worth a try这可能只对我有用,但值得一试

clear the office cache (C:\\Users\\username\\AppData\\Local\\Microsoft\\Office\\16.0\\OfficeFileCache\\0)清除办公缓存 (C:\\Users\\username\\AppData\\Local\\Microsoft\\Office\\16.0\\OfficeFileCache\\0)

open the file on a different computer and name it something random.在另一台计算机上打开文件并随机命名。 open the file on the first computer and resave file.在第一台计算机上打开文件并重新保存文件。

As pointed out in Han's comment, it's possible that the module is corrupted. 正如Han的评论所指出的那样,该模块可能已损坏。 You may be able to salvage it by right clicking the module and using 'Export File...' to save it as a class file. 您可以通过右键单击模块并使用“导出文件...”将其保存为类文件来挽救它。

If this succeeds you can attempt to recover your code by: 如果成功,您可以尝试通过以下方式恢复代码:

  1. Importing the saved file, this will add 'ThisWorkbook' as a class file that can be opened like other modules. 导入保存的文件,这将添加'ThisWorkbook'作为可以像其他模块一样打开的类文件。
  2. If this doesn't work, try opening the saved file in Notepad. 如果这不起作用,请尝试在记事本中打开保存的文件。 This should reveal your code in plain text. 这应该以纯文本显示您的代码。

I literally have this probablem every day or so.我真的每天都有这个probablem。 There is no answer, I have to save multiple files everytime I make any changes to the workbook.没有答案,每次对工作簿进行任何更改时,我都必须保存多个文件。 Its incredibly frustrating when all the macros disapear from the list and you can't open a single module当所有宏从列表中消失并且您无法打开单个模块时,它令人难以置信地令人沮丧

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM