开发者

MS Project 2010 - How to restore macros from (corrupt?) Global.MPT

开发者 https://www.devze.com 2023-02-03 17:45 出处:网络
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.

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 no开发者_StackOverflow社区t want to loose day of works :(


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 .\..|


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.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消