MS Project 2010 - 如何从(损坏?)Global.MPT 恢复宏

发布于 2024-10-12 04:09:31 字数 422 浏览 7 评论 0原文

我一天内开发了一些 VBA 宏 - 500 行代码。代码被放入 Global.mpt 中,因为我要在不同的项目文件中重用它。

在某个时刻,我错过了 while 循环中的增量循环。调试时,这会使 MS Project 陷入无响应的 100% CPU 使用率循环。我不得不从任务管理器中终止 MS Project,重新启动后我在 Global.mpt 中看到没有 VBA 模块。我在现有 Global.MPT 中看到变量和过程的名称,但没有可手动恢复的纯代码。

当我尝试将 Global.MPT 重命名为 MyGlobal.MPT 并打开它时,MS Project 显示“组织器”对话框,建议将内容从 MyGlobal.MPT 导入到 Global.MPT,但“模块”选项卡显示空列表,就像没有任何可导入的内容一样。

有没有办法修复或导出文件中的 VBA 内容?我不想浪费一天的工作:(

i was developing some VBA macro during a day - 500 lines of code. Code was placed into Global.mpt because i was going to reuse it across different project files.

At some moment i missed to increment cycle in the while cycle. When debugging this brought MS Project into endless non-responsive 100%-CPU-usage loop. I had to kill MS Project from task manager and after restarting it i see no VBA modules in Global.mpt. I see names of my variables and procedures in existing Global.MPT, but there is no plain code to restore manually.

When i try renaming Global.MPT into MyGlobal.MPT and opening it, MS Project shows 'Organizer' dialog suggesting to import content from MyGlobal.MPT to Global.MPT but 'Modules' tab shows empty list of like there is nothing to import.

Is there way to fix or export VBA content from the file? I do not want to loose day of works :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

楠木可依 2024-10-19 04:09:31

供参考 - 名为 MyModule 的模块,具有以下内容

Sub HelloWorld()
    MsgBox 'HelloWorld'
End Sub

看起来像 VBA 流中的以下内容

0012BA04  01 16 01 00 02 F0 00 00 00 BC 02 00 00 D4 00 00  |................|
0012BA14  00 B0 01 00 00 FF FF FF FF EA 02 00 00 8A 03 00  |................|
0012BA24  00 00 00 00 00 01 00 00 00 7D 0A CF 43 00 00 FF  |.........}..C...|
0012BA34  FF 03 00 00 00 00 00 00 00 B6 00 FF FF 01 01 00  |................|
0012BA44  00 00 00 FF FF FF FF 00 00 00 00 FF FF 04 00 FF  |................|
0012BA54  FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BA64  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BA74  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BA84  00 00 00 00 00 00 00 10 00 00 00 03 00 00 00 05  |................|
0012BA94  00 00 00 07 00 00 00 FF FF FF FF FF FF FF FF 01  |................|
0012BAA4  01 08 00 00 00 FF FF FF FF 78 00 00 00 02 00 00  |.........x......|
0012BAB4  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BAC4  00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF  |................|
0012BAD4  00 00 00 00 4D 45 00 00 FF FF FF FF FF FF 00 00  |....ME..........|
0012BAE4  00 00 FF FF 00 00 00 00 FF FF 01 01 00 00 00 00  |................|
0012BAF4  DF 00 FF FF 00 00 00 00 04 00 FF FF FF FF FF FF  |................|
0012BB04  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB14  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB24  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB34  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB44  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB54  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB64  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB74  FF FF FF FF FF FF FF FF FF FF 28 00 00 00 00 00  |..........(.....|
0012BB84  36 0A FF FF FF FF 00 00 00 00 02 3C 08 00 FF FF  |6..........<....|
0012BB94  00 00 00 00 02 3C 0C 00 FF FF 00 00 00 00 02 3C  |.....<.........<|
0012BBA4  FF FF FF FF 00 00 FF FF 01 01 00 00 00 00 00 00  |................|
0012BBB4  01 00 00 00 FF FF FF FF 01 01 80 00 00 00 38 00  |..............8.|
0012BBC4  00 00 FF FF FF FF 02 83 1C 02 FF FF FF FF 08 00  |................|
0012BBD4  FF FF 30 00 00 00 00 00 FF FF FF FF FF FF 00 00  |..0.............|
0012BBE4  00 00 FF FF FF FF FF FF FF FF 00 00 00 00 1D 00  |................|
0012BBF4  00 00 25 00 00 00 0B 12 1E 02 FF FF FF FF 00 00  |..%.............|
0012BC04  00 60 00 00 00 00 FF FF FF FF FF FF FF FF 00 00  |.`..............|
0012BC14  00 00 00 00 00 00 FF FF FF FF 7C FF 00 00 FF FF  |..........|.....|
0012BC24  FF FF FF FF FF FF FF FF FF FF 03 00 03 00 00 00  |................|
0012BC34  84 00 00 03 00 00 FF FF FF FF C0 01 00 00 01 00  |................|
0012BC44  01 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00  |..............8.|
0012BC54  00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BC64  FF FF FF FF FF FF 38 00 00 00 FF FF FF FF FF FF  |......8.........|
0012BC74  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BC84  FF FF FF FF FF FF 08 00 00 00 00 00 00 00 01 00  |................|
0012BC94  00 00 08 00 04 00 FF FF FF FF 00 00 00 00 FF FF  |................|
0012BCA4  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BCB4  FF FF FF FF FF FF 02 00 00 00 00 00 E4 E7 C5 4E  |...............N|
0012BCC4  0E 00 01 24 00 2A 00 5C 00 52 00 66 00 66 00 66  |...$.*.\.R.f.f.f|
0012BCD4  00 66 00 2A 00 30 00 3F 00 34 00 65 00 63 00 35  |.f.*.0.?.4.e.c.5|
0012BCE4  00 65 00 37 00 65 00 39 00 DF 00 00 00 00 00 00  |.e.7.e.9........|
0012BCF4  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BD04  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BD14  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BD24  00 00 00 00 00 00 FE CA 01 00 03 00 22 81 08 00  |............"...|
0012BD34  06 00 00 00 00 00 00 00 00 81 08 04 18 00 00 00  |................|
0012BD44  10 00 00 00 04 81 08 00 02 00 00 00 08 00 00 00  |................|
0012BD54  FF FF FF FF 01 01 30 00 00 00 96 04 38 00 00 00  |......0.....8...|
0012BD64  00 00 6F 00 FF FF 70 00 00 00 41 40 22 02 00 00  |..o...p...A@"...|
0012BD74  E0 00 0B 00 0B 00 48 65 6C 6C 6F 57 6F 72 6C 64  |......HelloWorld|
0012BD84  27 00 FF FF FF FF 50 00 00 00 FF FF FF FF 00 00  |'.....P.........|
0012BD94  01 52 B0 00 41 74 74 72 69 62 75 74 00 65 20 56  |.R..Attribut.e V|
0012BDA4  42 5F 4E 61 6D 00 65 20 3D 20 22 4D 79 4D 00 6F  |B_Nam.e = "MyM.o|
0012BDB4  64 75 6C 65 22 0D 0A 00 53 75 62 20 48 65 6C 6C  |dule"...Sub Hell|
0012BDC4  00 6F 57 6F 72 6C 64 28 29 08 0D 0A 20 00 00 4D  |.oWorld()... ..M|
0012BDD4  73 67 42 10 6F 78 20 27 07 64 27 0D 0A 10 45 6E  |sgB.ox '.d'...En|
0012BDE4  64 20 00 5C 0D 0A                                |d .\..|

For referrence - module named MyModule with following content

Sub HelloWorld()
    MsgBox 'HelloWorld'
End Sub

Looks like following in the VBA stream

0012BA04  01 16 01 00 02 F0 00 00 00 BC 02 00 00 D4 00 00  |................|
0012BA14  00 B0 01 00 00 FF FF FF FF EA 02 00 00 8A 03 00  |................|
0012BA24  00 00 00 00 00 01 00 00 00 7D 0A CF 43 00 00 FF  |.........}..C...|
0012BA34  FF 03 00 00 00 00 00 00 00 B6 00 FF FF 01 01 00  |................|
0012BA44  00 00 00 FF FF FF FF 00 00 00 00 FF FF 04 00 FF  |................|
0012BA54  FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BA64  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BA74  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BA84  00 00 00 00 00 00 00 10 00 00 00 03 00 00 00 05  |................|
0012BA94  00 00 00 07 00 00 00 FF FF FF FF FF FF FF FF 01  |................|
0012BAA4  01 08 00 00 00 FF FF FF FF 78 00 00 00 02 00 00  |.........x......|
0012BAB4  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BAC4  00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF  |................|
0012BAD4  00 00 00 00 4D 45 00 00 FF FF FF FF FF FF 00 00  |....ME..........|
0012BAE4  00 00 FF FF 00 00 00 00 FF FF 01 01 00 00 00 00  |................|
0012BAF4  DF 00 FF FF 00 00 00 00 04 00 FF FF FF FF FF FF  |................|
0012BB04  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB14  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB24  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB34  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB44  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB54  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB64  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BB74  FF FF FF FF FF FF FF FF FF FF 28 00 00 00 00 00  |..........(.....|
0012BB84  36 0A FF FF FF FF 00 00 00 00 02 3C 08 00 FF FF  |6..........<....|
0012BB94  00 00 00 00 02 3C 0C 00 FF FF 00 00 00 00 02 3C  |.....<.........<|
0012BBA4  FF FF FF FF 00 00 FF FF 01 01 00 00 00 00 00 00  |................|
0012BBB4  01 00 00 00 FF FF FF FF 01 01 80 00 00 00 38 00  |..............8.|
0012BBC4  00 00 FF FF FF FF 02 83 1C 02 FF FF FF FF 08 00  |................|
0012BBD4  FF FF 30 00 00 00 00 00 FF FF FF FF FF FF 00 00  |..0.............|
0012BBE4  00 00 FF FF FF FF FF FF FF FF 00 00 00 00 1D 00  |................|
0012BBF4  00 00 25 00 00 00 0B 12 1E 02 FF FF FF FF 00 00  |..%.............|
0012BC04  00 60 00 00 00 00 FF FF FF FF FF FF FF FF 00 00  |.`..............|
0012BC14  00 00 00 00 00 00 FF FF FF FF 7C FF 00 00 FF FF  |..........|.....|
0012BC24  FF FF FF FF FF FF FF FF FF FF 03 00 03 00 00 00  |................|
0012BC34  84 00 00 03 00 00 FF FF FF FF C0 01 00 00 01 00  |................|
0012BC44  01 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00  |..............8.|
0012BC54  00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BC64  FF FF FF FF FF FF 38 00 00 00 FF FF FF FF FF FF  |......8.........|
0012BC74  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BC84  FF FF FF FF FF FF 08 00 00 00 00 00 00 00 01 00  |................|
0012BC94  00 00 08 00 04 00 FF FF FF FF 00 00 00 00 FF FF  |................|
0012BCA4  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  |................|
0012BCB4  FF FF FF FF FF FF 02 00 00 00 00 00 E4 E7 C5 4E  |...............N|
0012BCC4  0E 00 01 24 00 2A 00 5C 00 52 00 66 00 66 00 66  |...$.*.\.R.f.f.f|
0012BCD4  00 66 00 2A 00 30 00 3F 00 34 00 65 00 63 00 35  |.f.*.0.?.4.e.c.5|
0012BCE4  00 65 00 37 00 65 00 39 00 DF 00 00 00 00 00 00  |.e.7.e.9........|
0012BCF4  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BD04  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BD14  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
0012BD24  00 00 00 00 00 00 FE CA 01 00 03 00 22 81 08 00  |............"...|
0012BD34  06 00 00 00 00 00 00 00 00 81 08 04 18 00 00 00  |................|
0012BD44  10 00 00 00 04 81 08 00 02 00 00 00 08 00 00 00  |................|
0012BD54  FF FF FF FF 01 01 30 00 00 00 96 04 38 00 00 00  |......0.....8...|
0012BD64  00 00 6F 00 FF FF 70 00 00 00 41 40 22 02 00 00  |..o...p...A@"...|
0012BD74  E0 00 0B 00 0B 00 48 65 6C 6C 6F 57 6F 72 6C 64  |......HelloWorld|
0012BD84  27 00 FF FF FF FF 50 00 00 00 FF FF FF FF 00 00  |'.....P.........|
0012BD94  01 52 B0 00 41 74 74 72 69 62 75 74 00 65 20 56  |.R..Attribut.e V|
0012BDA4  42 5F 4E 61 6D 00 65 20 3D 20 22 4D 79 4D 00 6F  |B_Nam.e = "MyM.o|
0012BDB4  64 75 6C 65 22 0D 0A 00 53 75 62 20 48 65 6C 6C  |dule"...Sub Hell|
0012BDC4  00 6F 57 6F 72 6C 64 28 29 08 0D 0A 20 00 00 4D  |.oWorld()... ..M|
0012BDD4  73 67 42 10 6F 78 20 27 07 64 27 0D 0A 10 45 6E  |sgB.ox '.d'...En|
0012BDE4  64 20 00 5C 0D 0A                                |d .\..|
蓝戈者 2024-10-19 04:09:31

其他解决方案是从备份中恢复。使用 Project 在另一台计算机上打开或修复用户配置文件。它可能已腐败。如果您可以使用其他用户名登录电脑并尝试打开该文件。祝你好运,

或者:

1] 获取文件 -->选项 -->信任中心-->点击信任中心设置-->选择选项“允许加载旧版或非默认文件格式的文件”并尝试打开该文件。

2]打开一个空白项目并尝试插入有问题的文件并尝试打开它。

Other solutions are to recover from backup. Open on another machine with Project or repair the User Profile. It may be corrupt. If you can log in with another username to the PC and try to open the file. Good luck,

OR:

1] Go t File --> Options --> Trust Center --> click on Trust Center Settings --> Select the option "Allow loading files with legacy or non-default file formats" and try opening the file.

2] Open a blank project and try inserting the problematic file and try opening it.

心碎的声音 2024-10-19 04:09:31

最简单的方法是将文件扩展名更改为 MPP 并将其作为项目打开。组织者会出现并询问您是否要将 MPP 的宏和代码复制到新的(空白)MPT 文件中。只需将它们滑过,您就可以了(您必须重置您的参考资料,但除此之外,准备好开始)

The easiest way is to simply change the file extension to MPP and open it as a project. The organizer will come up and ask you if you want to copy the MPP's macros and code into your new (blank) MPT file. Just slide them over and you're good as gold (you'll have to reset your references, but otherwise, ready to go)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文