Excel:如何获取与区域设置无关的打印机名称? [英] Excel: How to get a locale-independent printer name?
问题描述
在Excel中有一个 PrintOut
方法打印东西。
它接受打印机名称作为参数,该打印机名称不仅仅是系统打印机名称,而是打印机连接的系统打印机名称和端口的组合。
There's a PrintOut
method in Excel that prints stuff.
It accepts a printer name as a parameter, and that printer name is not just a system printer name, but a combination of both system printer name and port to which the printer is connected.
.PrintOut ActivePrinter:="MyPrinter" & " on " & "Ne00:"
如果只提供系统名称,Excel将找不到它,不会打印
If you only provide a system name, Excel will not find it and will not print.
请注意,中间的on
片段。实际的英语单词on使excel打印机名称人性化。
Note that " on "
piece in the middle. It is actual English word "on" that makes "excel printer name" human-friendly.
问题是,这个小块在每个本地化版本的Excel上是不同的。因此,要组合真正的excel打印机名称的代码将需要包含一个巨大的开关
,其中所有可能的Excel语言环境将被列出与相应的on翻译。我甚至没有这样的名单。但是我想拥有它,或者听到有一种方法可以快速找出这件作品。 Application.International
属性似乎不包含答案。
The problem is, this little piece is different on each localised version of Excel. Therefore, code that wants to compose true "excel printer name" would need to include a huge switch
where all possible Excel locales would be listed with corresponding translation of "on". I haven't even got such list. But I would like to have it, or to hear about a way to figure out this piece on the fly. The Application.International
property does not seem to contain an answer.
推荐答案
这个家伙使用注册表项
\HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices\
\HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices\
http: //www.dailydoseofexcel.com/archives/2008/04/05/getting-the-printer-port/
这篇关于Excel:如何获取与区域设置无关的打印机名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!