首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Err.description慢

Err.description慢
EN

Stack Overflow用户
提问于 2013-02-25 08:35:12
回答 1查看 153关注 0票数 3

这个程序在我的电脑上需要1-2秒。

慢度发生在行Debug.Print Err.Description

如果我用Err.number替换它,它需要0。

如果我更改代码以显示Type Mismatch错误消息,问题就会出现。

我正在使用Excel 2007,64位Windows。

我已经禁用了所有的外接程序

我将以下代码放入一个全新的.xlsm文件中。

问题不在于debug.print,如果我将其转换为字符串比较,问题就会继续存在。

代码语言:javascript
复制
Private Declare Function GetTickCount Lib "kernel32" () As Long

Public Sub Testing()
Err.Clear
Application.DisplayAlerts = False
Application.CutCopyMode = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
On Error GoTo Problem

    Dim a As Double
    a = 10 / 0
Problem:
    Dim sOutput As String
    Dim lStart As Long, lEnd As Long


    lStart = GetTickCount
    Debug.Print Err.Description
    lEnd = GetTickCount
    gsOutput = "Time requires : " & (lEnd - lStart) / 1000 & "s"
    Debug.Print gsOutput
End Sub

任何帮助都会很好。

编辑问题及解决方案:http://support.microsoft.com/kb/2683270

顺便说一句,如果微软已经提出了这个问题,我认为这不是一个本地化的问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-01 10:02:44

基本上,问题在于本地计算机上缺少一些注册表值。

如建议的那样这里

缺少由Excel进程在错误处理期间使用的winhelp.ini (您可以使用建议的工具进行检查)。

因此,它正在从其他%PATH%变量中查找到网络驱动器的C:\Windows\winhelp.ini。

1-2秒是网络延迟.

通过添加提到的注册表解决了这个问题。

HTH

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15062935

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档