Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
mrako
3485 Views, 14 Replies

Create a Excel file using VBA Inventor 2021+Excel2016 not works

Please help 

 

After updating from Inventor 2018 to Inventor 2021,

I can't create an excel file !


Inventor 2018 + Excel 2007   32-bit   ,  code works
Inventor 2021+ Excel 2007 32-bit  , code works


After updating to Inventor 2021
Inventor 2021+ Excel 2007  32-bit  , code works
Inventor 2021+ Excel 2016  32-bit , code does not works !

 

Thank you

Private Sub Conect_To_Excel()
''Dim oExcel As Excel.Application
Dim oExcel As Object

Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True

'Create new workbook
Call oExcel.Workbooks.Add

Dim oWorkbook As Object ''Workbook
Set oWorkbook = oExcel.Workbooks.Item(1)

Dim oWorkSheet As WorkSheet
Set oWorkSheet = oWorkbook.Sheets.Item(1)

oWorkSheet.Cells(1, 1).Value = "writing works"
oWorkbook.SaveAs ("E:\test.xls") 'Save excel
oExcel.Quit
Set oWorkSheet = Nothing
Set oWorkbook = Nothing
Set oExcel = Nothing

End Sub

Screenshot_4.png

Screenshot_5.png