5

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

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

今天晚上我把这个项目带回家时,我试图打开它来做一个快速的改变。这是我收到以下一系列错误消息的时候:

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

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

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

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

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

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

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

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

谢谢你!!!

4

5 回答 5

9

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

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.

于 2011-10-13T05:26:50.397 回答
1

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

Right answer. Select Run all from my computer for the Office Tools category in setup menu.

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

于 2014-05-28T22:54:38.697 回答
0

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.

于 2013-08-15T15:05:30.053 回答
0

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

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.

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.

于 2016-05-21T11:59:03.377 回答
0

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.

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.

于 2017-02-27T07:44:35.190 回答