如何漂亮打印VBA代码? [英] How to Pretty print VBA code?

查看:189
本文介绍了如何漂亮打印VBA代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将VBA代码复制到Word文档并保留VBA编辑器配色方案?

How do you copy VBA code into a Word document and retain the VBA editor color scheme?

推荐答案

您可以使用<一个href =http://notepad-plus.sourceforge.net/uk/site.htm =noreferrer>记事本++ 以三种方式完成。只是这样你知道,记事本++是一个更高级的记事本版本,它支持不同的代码文件开箱即用的语法突出显示 - Visual Basic包括!

You can use Notepad++ to accomplish this in three ways. Just so you know, Notepad++ is a more advanced version of Notepad, which supports syntax highlighting of different code files "out of the box" - Visual Basic included!

下载& ;安装它,启动它并加载您的VBA代码。你应该自动看到它漂亮的颜色(如果没有,因为文件扩展名不是 .vb ,请转到语言 - > VB或语言 - > V - > VB)

Download & install it, fire it up, and load up your VBA code. You should automatically see it beautifully coloured (if not, because the file extension is something other than .vb, go to Language -> VB or Language -> V -> VB).

如果您需要更改任何颜色,您可以轻松地执行此操作 - 只需转到设置 - >样式器配置器。从该菜单,您可以更改各种突出显示和字体选项,以满足您的需要 - 尽管默认通常足以满足您的需求。

If you need to change any of the colours, you can easily do so - just go to Settings -> Styler Configurator. From that menu, you can change the various highlighting and font options, to suit your needs - although the default usually suffices for most.

然后,转到插件 - > NppExport 。从那里你可以考虑三个选项:

Then, go to Plugins -> NppExport. From there, you have three options you can consider:


  • 直接从记事本++打印

  • 全部复制导出到HTML

  • 导出到RTF

  • 导出为HTML

  • Directly print from Notepad++
  • Copy all formats to clipboard
  • Export to RTF
  • Export to HTML

第一个是自我解释。第二个 - 将所有格式复制到剪贴板 - 将使用突出显示的语法将整个文件复制到剪贴板。一旦你点击它,然后打开Microsoft Word或其他喜欢的文档编辑器,只需点击粘贴!您应该看到精美的语法突出显示的代码。如果出现问题,那么您可以尝试其他选项(导出到RTF / HTML),尽管我从未对剪贴板方法有问题。

The first is self explanatory. The second one - "Copy all formats to clipboard" - will copy the entire file with the highlighted syntax to the clipboard. Once you click it, then open Microsoft Word or your other favourite document editor, and just hit paste! You should see the beautifully syntax-highlighted code. If something goes wrong, then you can try one of the other options (export to RTF/HTML), although I've never had a problem with the clipboard method.

这篇关于如何漂亮打印VBA代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆