Excel将XLL文件加载为文本文件

Excel将XLL文件加载为文本文件

本文介绍了C ++ Excel加载项加载错误:Excel将XLL文件加载为文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C ++和 XLW库构建Excel的XLL加载项.

I'm building XLL add-ins for Excel, using C++ and XLW library.

它在我的PC以及许多其他计算机上都可以正常工作.但是在某些情况下,当我将XLL拖到新的Excel窗口中时,会出现此错误:

It works fine on my PC, and on many others. But in some cases, when I drag the XLL into a new Excel window, this error shows up:

如果单击yes,则Excel将打开XLL作为文本文件,显示如下内容:

If click yes, then Excel will open the XLL as a text file, showing something like this:

在第一行.预计不会发生这种情况.可能是什么原因?

right at the first row. This is not expected to happen. What could be the reason for that?

这是所有计算机的系统配置:

This is the system configuration of all machines:

  • Microsoft Windows 7 Professional 64位(操作系统)
  • Microsoft Excel 2010 32位

推荐答案

总而言之,错误代码This program cannot be run in DOS mode.通常与以下问题之一相关:

To summarize, the error code This program cannot be run in DOS mode. is usually related to one of the following issues:

  1. XLL是使用/MD标志构建的,但是最终用户没有必需的CRT DLL.

  1. The XLL is built with the /MD flag, but end-users do not have the required CRT DLLs.

XLL是在错误的平台上编译的;例如平台x64用于构建XLL,然后将其加载到32位Excel中(反之亦然).

The XLL is compiled with the wrong platform; e.g. Platform x64 being used for building your XLL, and then it is loaded in 32-bit Excel (or vice-versa).

缺少一个外部DLL依赖项.

There is a missing external DLL dependency.

使用/MD标志(运行时库的特定于多线程和特定于DLL的版本)构建了一个外部DLL依赖项.在这种情况下,如果最终用户具有正确版本的CRT(用于构建外部DLL的版本),则没有问题.否则,强烈建议您使用/MT标志(多线程,运行时库的静态版本)重建外部DLL(如果可能).甚至更好的是,将其静态链接到您的XLL(使用静态.lib文件作为第三方组件构建的输出).

There is an external DLL dependency which has been built with the /MD flag (multithread-specific and DLL-specific version of the run-time library). In this case, there is no problem if end-users have the correct version of the CRT (the one that has been used to build the external DLL). Otherwise it is strongly recommended to rebuild your external DLL (if possible) with the /MT flag (multithread, static version of the run-time library). Or even better, to statically link it to your XLL (using static .lib file as the output of the build of your third party component).

我相信最后一个可能是您的情况.

I believe the last one might be your case.

这篇关于C ++ Excel加载项加载错误:Excel将XLL文件加载为文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 18:58