vba 无需打开excel即可检索/阅读excel宏?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41937976/
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-12 12:00:16  来源:igfitidea点击:

Retreiving/reading excel macro without opening excel?

excelvbaexcel-vbams-office

提问by Martin KS

I wrote an excel macro that seems to have broken, unfortunately when I try to edit the macro in the VBA editor, excel itself crashes spectacularly. This seems to happen whether I open the VBA Editor before or after loading the problematic excel file.

我写了一个似乎坏了的 excel 宏,不幸的是,当我尝试在 VBA 编辑器中编辑宏时,excel 本身崩溃了。无论我是在加载有问题的 excel 文件之前还是之后打开 VBA 编辑器,这似乎都会发生。

Does anyone know of a way of viewing the VBA code that I've written without using excel to get there? Alternatively, can anyone get to the VBA code in (this excel file)(Link Removed) without it crashing their excel?

有谁知道一种查看我编写的 VBA 代码而不使用 excel 的方法?或者,任何人都可以访问(此 excel 文件)(链接已删除)中的 VBA 代码而不会使其 excel 崩溃?

Unlike "Running Macros without opening excel" I don't need to be able to run the broken code without excel - just copy and paste it somewhere to fix it!

与“在不打开 excel 的情况下运行宏”不同,我不需要能够在没有 excel 的情况下运行损坏的代码 - 只需将其复制并粘贴到某处即可修复它!

采纳答案by A.S.H

I created a fresh new excel file and open the VBA editor. Then I opened the one you provided, but I had put it in a non-secure folder. Excel prompted me the choice of opening it with macros disabled. I did, and I could see the code in the editor. :)

我创建了一个全新的 Excel 文件并打开 VBA 编辑器。然后我打开了你提供的那个,但我把它放在了一个不安全的文件夹中。Excel 提示我选择在禁用宏的情况下打开它。我做到了,我可以在编辑器中看到代码。:)