微软最近破解了我们长期以来(并由他们正式推荐)的代码,以读取 Excel 版本及其当前的 omacro 安全级别。
过去的工作:
// Get the program associated with workbooks, e.g. "C:\Program Files\...\Excel.exe"
SHELLAPI.FindExecutable( 'OurWorkbook.xls', ...)
// Get the version of the .exe (from it's Properties...)
WINDOWS.GetFileVersionInfo()
// Use the version number to access the registry to determine the security level
// '...\software\microsoft\Office\' + VersionNumber + '.0\Excel\Security'
(我总是很高兴安全级别多年来一直处于不安全的注册表项中......)
在 Office 2010 中,.xls 文件现在与“Microsoft Application Virtualization DDE Launcher”或 sftdde.exe 相关联。这个exe的版本号显然不是Excel的版本。
我的问题:
除了实际启动 Excel 并查询它的版本和安全级别(使用 OLE CreateOLEObject('Excel.Application'))之外,是否有一种更清洁、更快或更可靠的方法可以适用于从 Excel 2003 开始的所有版本?