【问题标题】:Excel VBA Macro Hangs When Power Query Add-in Activated激活 Power Query 加载项时 Excel VBA 宏挂起
【发布时间】:2019-07-22 14:46:54
【问题描述】:

我每天都在计划任务上运行几个 Excel 2013/32 位 VBA 宏,没有问题。

当我激活“电源查询”加载项并且没有进行任何更改时,宏会挂起并出现以下错误:

    See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
Microsoft.Mashup.Client.ClientShared.Com.ComWrapperException: Cannot cast null to type 'System.Double'. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Mashup.Client.ClientShared.Com.ComWrapper.As[T](Object value)
   --- End of inner exception stack trace ---
   at Microsoft.Mashup.Client.ClientShared.Com.ComWrapper.As[T](Object value)
   at Microsoft.Mashup.Client.Excel.Com.ExcelComWrapper.AsIntFromDouble(Object value)
   at Microsoft.Mashup.Client.Excel.Com.Application.get_Build()
   at Microsoft.Mashup.Client.Excel.Com.ApplicationFeatures..ctor(IApplication application)
   at Microsoft.Mashup.Client.Excel.Com.Application..ctor(Object application, Boolean enableEvents)
   at Microsoft.Mashup.Client.Excel.AddIn.TryCreateApplication(Object appObject, IApplication& application)
   at Microsoft.Mashup.Client.Excel.AddIn.Extensibility.IDTExtensibility2.OnConnection(Object application, ext_ConnectMode connectMode, Object addInInst, Array& custom)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Microsoft.Mashup.Client.Excel
    Assembly Version: 1.0.0.0
    Win32 Version: 2.35.4399.761
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Power%20Query%20for%20Excel/bin/Microsoft.Mashup.Client.Excel.dll
----------------------------------------
Extensibility
    Assembly Version: 7.0.3300.0
    Win32 Version: 7.00.9466
    CodeBase: file:///C:/Windows/assembly/GAC/Extensibility/7.0.3300.0__b03f5f7f11d50a3a/Extensibility.dll
----------------------------------------
office
    Assembly Version: 15.0.0.0
    Win32 Version: 15.0.4859.1000
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/office/15.0.0.0__71e9bce111e9429c/office.dll
----------------------------------------
Microsoft.Mashup.Client.Windows
    Assembly Version: 1.0.0.0
    Win32 Version: 2.35.4399.761
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Power%20Query%20for%20Excel/bin/Microsoft.Mashup.Client.Windows.DLL
----------------------------------------
Microsoft.Mashup.Document
    Assembly Version: 1.0.0.0
    Win32 Version: 2.35.4399.761
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Power%20Query%20for%20Excel/bin/Microsoft.Mashup.Document.DLL
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
Microsoft.MashupEngine
    Assembly Version: 1.0.0.0
    Win32 Version: 2.35.4399.761
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Power%20Query%20for%20Excel/bin/Microsoft.MashupEngine.DLL
----------------------------------------
Microsoft.Mashup.Client.AddinTelemetry
    Assembly Version: 1.0.0.0
    Win32 Version: 2.35.4399.761
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Power%20Query%20for%20Excel/bin/Microsoft.Mashup.Client.AddinTelemetry.DLL
----------------------------------------
Microsoft.Mashup.ProviderShared
    Assembly Version: 1.0.0.0
    Win32 Version: 2.35.4399.761
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Power%20Query%20for%20Excel/bin/Microsoft.Mashup.ProviderShared.DLL
----------------------------------------
Microsoft.Office.Interop.Excel
    Assembly Version: 15.0.0.0
    Win32 Version: 15.0.4569.1506
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Interop.Excel/15.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Excel.dll
----------------------------------------
Microsoft.Mashup.Client.Models
    Assembly Version: 1.0.0.0
    Win32 Version: 2.35.4399.761
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Power%20Query%20for%20Excel/bin/Microsoft.Mashup.Client.Models.DLL
----------------------------------------
Microsoft.Practices.Unity
    Assembly Version: 2.1.505.0
    Win32 Version: 2.1.505.2
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Power%20Query%20for%20Excel/bin/Microsoft.Practices.Unity.DLL
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.Mashup.EventSource
    Assembly Version: 1.0.0.0
    Win32 Version: 2.35.4399.761
    CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Power%20Query%20for%20Excel/bin/Microsoft.Mashup.EventSource.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

弹出错误

当我删除加载项“电源查询”并运行宏时,不会发生错误。

如何激活加载项?

【问题讨论】:

  • 如果您打开一个空白 Excel 工作簿,或者仅当您使用其中一个宏时,Power Query 是否会以同样的方式崩溃?

标签: excel vba powerquery


【解决方案1】:

您需要执行以下操作:

  • 检查您是否有最新版本的 PowerQuery。

  • 打开 VBA 编辑器 (Alt+F11) 并在开始处设置断点 宏。然后一步步执行,定位到导致PQ的那一行 挂。您也可以在此模式下启动宏,方法是将光标放入并按 F8。

  • 通过单击“发送皱眉”向 Microsoft 报告错误,其中包含一些 您的代码,包括导致挂断的行。

  • 您也可以在此处编写它,因为我们可能可能会提出一些建议(因为这似乎是 PowerQuery 中未处理的异常)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-28
    • 1970-01-01
    • 1970-01-01
    • 2013-05-09
    相关资源
    最近更新 更多