01-17-2017
02:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
01-17-2017
02:04 AM
Hey, it crashed due to an error in loading of the Excell interop library, so I don't think adding the reference manually will resolve this.
However you can still use Excel, even with broken library connection (thanks to the late binding). It's similar to what MechMachineMan suggested, except you won't cast the object to Excel types, but use them as objects.
Sub Main()
Dim oExcelPath As String = "G:\FSH_Engineering\ENGINEERING DRAWINGS\_DRAWING TEMPLATES\_INVENTOR\_START PARTS\UTILITY\GAUGE.xlsx"
Dim oExcel As Object = CreateObject("Excel.Application")
oExcel.Visible = False
oExcel.DisplayAlerts = False
Dim oWB As Object = oExcel.Workbooks.Open(oExcelPath)
Dim oWS As Object = oWB.Sheets(1) 'Sheet 1
oWS.Activate()
'In this sample, when you're getting a cell, the row is first
MsgBox("Cell A2 is: " & oWS.Cells(2, 1).Value)
'oWB.Save() 'Use this to save it
oWB.Close (True)
oExcel.Quit
oExcel = Nothing
End Sub
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods