Application.Printers在远程桌面会话上运行缓慢,为什么?

时间:2018-02-01 17:15:56

标签: vba ms-access remote-desktop

我在许多Microsoft Access应用程序中都有代码,使用以下代码填充列表中包含所有可用打印机的名称:

For Each ptr In Application.Printers
...

在本地运行应用程序时,使用此代码的过程运行得非常快。

在远程桌面会话中运行相同的应用程序时,通常只需几秒钟。

对于一个客户端,这一行代码需要90秒才能执行,但只是每个用户每天第一次,即使在远程桌面会话正确终止并重新启动之后也是如此。然后问题会在几个小时或第二天重新出现。

服务器是Windows Server 2008 R2 Datacenter,SP1
Microsoft Office Professional Plus 2010 14.0.7188.5002

我错过了什么?

2 个答案:

答案 0 :(得分:0)

If you allow the remote RDP session to include your LOCAL printers in that list, then it stands to reason that grabbing the printer list over the network going to be rather slow.

When you launch the RDP client, you can disable this “feature” of the remote system being able to use your LOCAL printer(s) for software running on that remote server. And even worse is your local session might have several printers on YOUR network - this whole process thus can take considerable time - and it can be rather slow.

So disable your local printer use - that option allows the remote server to communicate with and use your local printers - a slow process.

I would suggest you un-check this option when they launch the RDP client:

enter image description here

答案 1 :(得分:0)

事实证明,远程桌面服务器上设置的错误或有问题或不合作的打印机驱动程序是罪魁祸首。即使本地打印机关闭,也经历了90秒的延迟。删除服务器上的错误打印机设置解决了该问题。使用本地打印机只会导致几秒钟的延迟。每个人都建议问题可能是本地打印机导致关闭它们然后消除了本地打印机作为罪魁祸首,所以感谢大家的投入。