如何恢复此 VBA 项目?Excel 错误消息:“已删除部分:/xl/vbaProject.bin 部分。”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5124184/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 11:10:41  来源:igfitidea点击:

How do I recover this VBA Project? Excel Error message: "Removed Part: /xl/vbaProject.bin part."

excelvbaexcel-vbafile-recoverycorrupt-data

提问by Tom Winchester

I've seen related posts on other forums about this (see: http://www.mrexcel.com/forum/showthread.php?t=372534), but I've attempted everything that I've found with no success.

我在其他论坛上看到过相关帖子(参见:http: //www.mrexcel.com/forum/showthread.php?t=372534),但我尝试了所有我发现的方法,但都没有成功。

Here's the situation: I have a .xlsm workbook (named 'PTPro.xlsm') that contains around 2000+ lines of VBA code in a Module and 6-7 large UserForms each with their own giant chunk of code. Earlier today, I was working on the project and everything was going just fine. I saved, closed, and opened the file about 20 times total throughout the process. Never once did I receive an error message. It should be noted (in case it's important) that I was saving directly to a flash drive from Excel.

情况如下:我有一个 .xlsm 工作簿(名为“PTPro.xlsm”),它在一个模块中包含大约 2000 多行 VBA 代码和 6-7 个大型用户窗体,每个用户窗体都有自己的大量代码。今天早些时候,我正在做这个项目,一切都很顺利。在整个过程中,我保存、关闭和打开文件总共大约 20 次。我从来没有收到过错误信息。应该注意(以防万一),我是直接从 Excel 保存到闪存驱动器的。

When I brought the project home this evening, I attempted to open it to make a quick change. This is when I received the following series of error messages:

当我今晚将项目带回家时,我试图打开它以进行快速更改。这是我收到以下一系列错误消息的时候:

  1. "Excel found unreadable content in 'G:\PTPro\PTPro.xlsm'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes."

  2. After clicking yes, a new dialog box opens with the following error message:

  3. "Excel was able to open the file by repairing or removing the unreadable content. Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA))"

  4. My only option at this stage is to click 'Close' which loads the workbook.

  5. When I hit Alt+F11 to view the VBA editor, the entire VBA project (modules, userforms, macros, etc.) is COMPLETELY GONE!!!

  1. “Excel 在 'G:\PTPro\PTPro.xlsm' 中发现无法读取的内容。是否要恢复此工作簿的内容?如果信任此工作簿的来源,请单击“是”。

  2. 单击是后,将打开一个新对话框,其中包含以下错误消息:

  3. “Excel 能够通过修复或删除不可读的内容来打开文件。删除的部分:/xl/vbaProject.bin 部分。(Visual Basic for Applications (VBA))”

  4. 在此阶段,我唯一的选择是单击加载工作簿的“关闭”。

  5. 当我按 Alt+F11 查看 VBA 编辑器时,整个 VBA 项目(模块、用户窗体、宏等)完全消失了!!!

I've followed all of the steps that I can find, including changing the Excel defaults to enable all macros and to tring to open the file on 4 different computers (both from the hard drive and from the flash drive). The only thing that I can think of that I haven't tried yet is opening the file on the computer that I was working on today (which is a shared computer in a public computer lab, by the way). This won't be an option until Monday.

我已按照我能找到的所有步骤进行操作,包括更改 Excel 默认设置以启用所有宏,并尝试在 4 台不同的计算机(从硬盘驱动器和闪存驱动器)上打开文件。我唯一能想到的我还没有尝试过的事情是在我今天工作的计算机上打开文件(顺便说一下,这是公共计算机实验室中的共享计算机)。直到星期一,这才成为一种选择。

It should be noted that there are several sub-workbooks that include intermediate steps required by my application that were opened and closed frequently throughout the day, as well. They are all working just fine.

应该注意的是,有几个子工作簿包括我的应用程序所需的中间步骤,这些步骤在一天中也经常打开和关闭。他们都工作得很好。

If you have ANY experience with this problem, or ANY ideas as to how I might recover the code I've written, I would be EXTREMELY grateful!!!

如果您对这个问题有任何经验,或者任何关于如何恢复我编写的代码的想法,我将非常感激!!!

THANK YOU!!!

谢谢你!!!

回答by indrap

I have similar problem when i try to run my VBA script inside client PC.

当我尝试在客户端 PC 中运行我的 VBA 脚本时,我遇到了类似的问题。

The problem is because the client PC doesn't install Microsoft Office Visual Basic Application. By running office setup then add Visual Basic Application Feature, the script successfully running.

问题是因为客户端 PC 没有安装 Microsoft Office Visual Basic 应用程序。通过运行office setup然后添加Visual Basic Application Feature,脚本成功运行。

回答by thomas

The problem is because the client PC doesn't install Microsoft Office Visual Basic Application

问题是因为客户端 PC 没有安装 Microsoft Office Visual Basic 应用程序

Right answer. Select Run all from my computerfor the Office Toolscategory in setup menu.

正确答案。为设置菜单中的Office 工具类别选择从我的计算机运行全部

Developers... Was it so hard to find a better error message ?

开发人员...很难找到更好的错误消息吗?

回答by Karl

! i got to solve this problem for my xlsm-files !

!我必须为我的 xlsm 文件解决这个问题!

the VBA-code was written on my mac an there i (since i am from Germany) put some "?" "?" and "ü" (so special signs) in some of the Userform-names. Now the Excel 2010 on Windows could not read these signs and the file got corrupted. Solvation: i have replaced all special signs (like "?", "?", "ü", ...) with standard ones and e voila -> everything worked fine.

VBA 代码是写在我的 Mac 上的,我(因为我来自德国)在那里放了一些“?” “?” 和一些用户表单名称中的“ü”(非常特殊的符号)。现在 Windows 上的 Excel 2010 无法读取这些标志并且文件已损坏。解决方案:我已经用标准符号替换了所有特殊符号(如“?”、“?”、“ü”、...),然后瞧 -> 一切正常。

Hope this helps you as it helps me right now!

希望这对你有帮助,因为它现在对我有帮助!

I had really had to laugh hard about such an dumb bug and this inconsistency between the OS.

我真的不得不为这样一个愚蠢的错误和操作系统之间的这种不一致而苦笑。

回答by Vivek Amilkanthawar

Check if the Language settings on your pc are the same required for running macro.

检查您电脑上的语言设置是否与运行宏所需的相同。

Macro might have special characters written in it and thus the primary input language of your PC should the same as that of Micro.

宏可能会写入特殊字符,因此您 PC 的主要输入语言应与 Micro 相同。

In my case macro was written in Japan having few Japanese characters in it and primary input language of my PC was English (India). Removing it and keeping only Japanese solved my problem.

在我的情况下,宏是在日本编写的,里面几乎没有日语字符,我的电脑的主要输入语言是英语(印度)。删除它并只保留日语解决了我的问题。

回答by Damian Fronc

My friend said that you have change in Registry Editor HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Common\VBAOff. In the "Value data" box, make the change from 1 to 0 or press the delete key (click the right mouse button and click Delete). Exit Registry Editor.

我朋友说你在注册表编辑器 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Common\VBAOff 中发生了变化。在“数值数据”框中,从 1 更改为 0 或按删除键(单击鼠标右键并单击删除)。退出注册表编辑器。