码迷,mamicode.com
首页 > Web开发 > 详细

VB.NET自动加载宏

时间:2014-12-23 19:35:15      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:vb.net      自动加载   addins   

VB.NET自动加载.xla文件

Public Function Loadxla(ByVal xlaPath As String, ByVal load As Boolean) As Boolean
        Dim loaded As Boolean = False
        Try
            If (File.Exists(xlaPath)) Then
                Dim o As Object
                o = XlApp.AddIns.Add(xlaPath, True)  '定义成object,add by danielinbiti

                o.Installed = load
                loaded = o.Installed
            End If
        Catch
            loaded = False
        End Try
        Loadxla = loaded
    End Function

调用如

Loadxla("E:\selfh.xla", True)

Xlapp为Excel.Application对象


VB.NET自动加载宏

标签:vb.net      自动加载   addins   

原文地址:http://blog.csdn.net/danielinbiti/article/details/42105567

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!