如何在VBA项目名称中放置空格? [英] How can I put spaces in my VBA project name?

查看:291
本文介绍了如何在VBA项目名称中放置空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用VBA编写的Excel加载项,我们称它为MyAddin.xlam.
我已将项目名称设置为MyAddin.

I have an Excel add-in I wrote in VBA, let's call it MyAddin.xlam.
I have set the project name as MyAddin.

当我打开第二个项目并选择Tools->References...时,MyAddIn看起来很好.一切正常.那太棒了.

When I open a second project and choose Tools->References..., MyAddIn appears just fine. Everything works. That's great.

但是,出于纯粹的美学原因,我希望该列表在参考文献列表中以My Addin的形式出现. 潜在参考列表中几乎所有可用的名称中都有空格.
但是,如果我尝试将项目重命名为名称中有一个空格,则VBA不允许这样做.

But.. for purely aesthetic reasons, I would like the listing to appear as My Addin in the list of References. Pretty much everything available in the list of potential References has spaces in the name.
But if I try to rename my project to have a space in the name, VBA doesn't allow me to do that.

那么,听起来可能很愚蠢,有什么办法可以在参考"列表中为我的VBA加载项的显示名称添加空格?

So, silly as the question may sound, is there any way I can get spaces into the displayed name of my VBA add-in in the "References" list?

我非常愿意接受在VBA中这是不可能的;如果您使用另一种语言构建外接程序,则只能在参考名称中放置空格"的答案,但是我想知道自己是否缺少一些简单的东西.

I'm perfectly willing to accept the answer "This isn't possible in VBA; you can only put spaces in the reference name if you build the add-in with another language", but I'm wondering if I am missing something simple.

谢谢!

编辑,补遗:本质上,我的问题是:是否有一种方法可以使显示名称"与项目名称不同,而不必关心文件命名/对象命名限制?

EDIT, Addendum: Essentially, my question is: Is there a way to get the "displayed name" to be different from the project name, which doesn't care about filenaming/object naming restrictions?

推荐答案

是的,您是对的. VBA不允许您在属性"窗口的项目名称"中插入空格.

Yup you are right. VBA will not let you insert spaces in the Project Name in the Properties window.

如果尝试这样做,将给您一个错误(请参阅快照)

If you try to, it will give you an error (see snapshot)

也不要错过VB.net.我添加了空格,并将其转换为Excel中的下划线.让我进行更多测试,然后再回头...

Well No Luck with VB.net as well. I added the space and it converted it to an underscore in Excel. let me test it more and get back to you...

快照

关注

Ph,终于来了!是的,在VB.Net中是可能的.让我知道您是否需要更多详细信息?

Phew Finally! Yes it is possible in VB.Net. Let me know if you want more details?

这篇关于如何在VBA项目名称中放置空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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