07-23-2024
06:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
07-23-2024
06:55 AM
I can get you started, this is why I was mentioning imports earlier.
Imports Microsoft.Office.Interop 'To use excel
Imports Microsoft.Office.Interop.Excel 'To use excel
AddReference "Microsoft.Office.Interop.Excel" 'To use excel
BOMPath = "C:\BOM Calculator\PART_BOM.xlsx" 'FINAL DESTINATION OF BOM RESULTS
'[ CREATE EXCEL APPLICATION, INSERT HEADER, AND CLOSE PREVIOUS INSTANCE IF STILL OPEN]
Try : ExcelAPP = GetObject(BOMPath) : ExcelAPP.Save : ExcelAPP.Application.Quit : My.Computer.FileSystem.DeleteFile(BOMPath) : Catch : End Try
ExcelAPP = CreateObject("Excel.Application") : ExcelAPP.Visible = True: ExcelAPP.DisplayAlerts = False
'AppActivate(ExcelAPP)
ExcelWB = ExcelAPP.Workbooks.Add
ExcelWB.SaveAs(BOMPath)
With ExcelAPP
.Range("A1") = "TEST"
End With
ExcelAPP = Nothing