Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Visual Basic and Excel export issue

sebastian_varelaRD3LQ
Participant

Visual Basic and Excel export issue

sebastian_varelaRD3LQ
Participant
Participant

Hello,

I'm developing an inventor addin to improve our workflow, using vb.NET. Currently my goal is to export all the Excel tables of a drawing to the same file, however, my addin does works when I debug but not when I release and install,  and I cannot debug any error in the console. I am importing the following:

 

Imports System.Runtime.InteropServices
Import Inventor
Imports Microsoft.Win32
Imports Excel = Microsoft.Office.Interop.Excel
Imports System.Collections.Generic

 

Is there anything else I need to do to work the Excel export from Inventor?

 

I'll be grateful for any help,

SV

0 Likes
Reply
234 Views
3 Replies
Replies (3)

Frederick_Law
Mentor
Mentor

If it worked in debug then it should work when released.

What's the problem after release and install?

0 Likes

sebastian_varelaRD3LQ
Participant
Participant

The problem is that it doesn't even start the sub that uses the excel's library

 

Private Sub ExportExcel(drawingDoc As DrawingDocument, excelFilePath As String, boxTitle As String)

MsgBox("EXCEL INSTANCE N°0")

'Crear una instancia de Excel
Dim excelApp As New Excel.Application
MsgBox("EXCEL INSTANCE N°1")
.
.
.
End Sub

This is the start of my sub, I put those msgboxes but "EXCEL INSTANCE N°0" never appears

0 Likes

A.Acheson
Mentor
Mentor

Hi @sebastian_varelaRD3LQ 

 

From your past message you have not got an instance of excel.From this article here is how to set up the object.
The API help doesn’t show this method as a sample or documents which is a little weird really. 

‘Check if Excel is running and close it first
Dim oExcel As Excel.Application
oExcel = GetObject(, “Excel.Application”)

If Not (oExcel Is Nothing) Then
MsgBox “Close Excel first.”
Exit Sub
End If
‘Open Excel.

oExcel = CreateObject(“Excel.Application”)

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes