检测已安装的Excel版本(和Service Pack)

编程入门 行业动态 更新时间:2024-10-11 17:29:17
本文介绍了检测已安装的Excel版本(和Service Pack)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要能够从我正在开发的一些.NET代码中检测我的机器中安装的哪个版本的Excel。我目前正在使用 Application.Version ,但不提供有关Service Pack的信息。

I need to be able to detect which version of Excel I have installed in my machine from some .NET code I'm developing. I'm currently using Application.Version for that, but it doesn't give me information about Service Packs.

我最好指导远离这样的事情: www.mvps/ access / api / api0065.htm

I would preferably to steer away from something like this: www.mvps/access/api/api0065.htm

欢迎托管代码

推荐答案

Public Shared Function GetExcelVersion() As Integer Dim excel As Object = Nothing Dim ver As Integer = 0 Dim build As Integer Try excel = CreateObject("Excel.Application") ver = excel.Version build = excel.Build Catch ex As Exception 'Continue to finally sttmt Finally Try Marshal.ReleaseComObject(excel) Catch End Try GC.Collect() End Try Return ver End Function

如果找不到excel,则返回0。

Returns 0 if excel not found.

更多推荐

检测已安装的Excel版本(和Service Pack)

本文发布于:2023-11-02 10:12:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552096.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:版本   Excel   Pack   Service

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!