none
Excel Interop Assemblies RRS feed

  • Question

  • I've taken over updating a program that uses the office primary interop assemblies to export a data table as a workbook page., using the office Primary Interop Assemblies.  Before it tries to do this, in order to prevent issues, it has  a check to see if excel is installed on the machine.  This is done with the following code block:

                Officetype = Type.GetTypeFromProgID("Excel.Application")
                If IsNothing(Officetype) Then
                    MsgBox("Microsoft Excel is not installed, export cannot continue", vbOKOnly)
                    Exit Sub
                End If

    I'm probably missing something here, because I have a user who is using Office 365 Business that has Excel version 1907 installed on their machine, and this is returning true and exiting out.  I have tried having them install the Iterop Assemblies for 2010 but this has not had any effect and I'm not sure where to proceed next.  

    Monday, August 26, 2019 3:36 PM

All replies

  • Hi,

    I made a sample with VB.Net (not VBA).
        
    Here's code.
    Imports System
    Imports System.Collections.Generic
    Imports System.ComponentModel
    Imports System.Data
    Imports System.Drawing
    Imports System.Text
    Imports System.Windows.Forms
    
    Public Class Form1
    	Private Sub btn_Check_Click(sender As Object, e As EventArgs) Handles btn_Check.Click
    		If (Type.GetTypeFromProgID("Excel.Application") Is Nothing) Then
    			Me.lbl_Result.Text = "Excel not installed."
    		Else
    			Dim myResult As String = Type.GetTypeFromProgID("Excel.Application").ToString
    			If (myResult.Contains("Interop")) Then
    				Me.lbl_Result.Text = "Excel (Desktop Application) has been installed." _
    						& Chr(13) & Chr(13) & myResult
    			Else
    				Me.lbl_Result.Text = "Excel (Store App [UWP] has been installed." _
    						& Chr(13) & Chr(13) & myResult
    			End If
    		End If
    	End Sub
    End Class
    Regards,

    Ashidacchi -- https://ssl01.rocketnet.jp/hokusosha.com/default.html

    Wednesday, August 28, 2019 9:17 AM