用于检查 PowerPivot 并提示用户安装的脚本

发布于 2024-12-22 03:30:53 字数 49 浏览 1 评论 0原文

有人见过用于检查用户的 PowerPivot 加载项并为用户提供安装对话框的脚本吗?

Has anyone seen a script for checking a user's add-ins for PowerPivot and giving the user the dialog to install?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逆蝶 2024-12-29 03:30:53

不幸的是,PowerPivot 似乎没有列在 VBA 可访问的已安装加载项列表中。

也许你想尝试这个:

Sub installPowerPivot()
If Not isPowerPivotInstalled Then
    MsgBox "PowerPivot is not installed on this machine." & vbCrLf & vbCrLf & _
        "Please visit this website to download the PowerPivot add-in:" & vbCrLf & _
        "http://powerpivot.com"
End If
End Sub


Function isPowerPivotInstalled() As Boolean
Const checkFile As String = "\Microsoft Analysis Services\AS Excel Client\10\Microsoft.AnalysisServices.Modeler.FieldList.dll"
Dim tempFSO As Object
Set tempFSO = CreateObject("Scripting.FileSystemObject")

'check x86 program files folder
If tempFSO.fileexists(Environ("ProgramFiles(x86)") & checkFile) Then
    isPowerPivotInstalled = True
    Exit Function
End If

'if it's a 64bit machine also check the 64bit program files folder
If LCase(Environ("processor_architecture")) = "amd64" Then
    If tempFSO.fileexists(Environ("ProgramW6432") & checkFile) Then
        isPowerPivotInstalled = True
        Exit Function
    End If
End If

'if both checks fail -> false
isPowerPivotInstalled = False
End Function

Unfortunately PowerPivot doesn't seem to be listed in the VBA-accessible list of installed add-ins.

Maybe you would like to try this:

Sub installPowerPivot()
If Not isPowerPivotInstalled Then
    MsgBox "PowerPivot is not installed on this machine." & vbCrLf & vbCrLf & _
        "Please visit this website to download the PowerPivot add-in:" & vbCrLf & _
        "http://powerpivot.com"
End If
End Sub


Function isPowerPivotInstalled() As Boolean
Const checkFile As String = "\Microsoft Analysis Services\AS Excel Client\10\Microsoft.AnalysisServices.Modeler.FieldList.dll"
Dim tempFSO As Object
Set tempFSO = CreateObject("Scripting.FileSystemObject")

'check x86 program files folder
If tempFSO.fileexists(Environ("ProgramFiles(x86)") & checkFile) Then
    isPowerPivotInstalled = True
    Exit Function
End If

'if it's a 64bit machine also check the 64bit program files folder
If LCase(Environ("processor_architecture")) = "amd64" Then
    If tempFSO.fileexists(Environ("ProgramW6432") & checkFile) Then
        isPowerPivotInstalled = True
        Exit Function
    End If
End If

'if both checks fail -> false
isPowerPivotInstalled = False
End Function
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文