I have extensive code that creates reports in EXCEL from SQL DATA.
I have a VB.NET program that calls the sheet.
Public Sub doit()
Dim xlApp As New Excel.Application
Dim xlWorkBook As Excel.Workbook = Nothing 'New Excel.Workbook
xlWorkBook = xlApp.Workbooks.Open(My.Settings.ROBSUtility)
xlApp.Visible = True
xlApp.Visible = False
The code 'printAutoRobs' worked fine last week, and still works fine in EXCEL 2013 and down on other PC's... so far...
On PC with EXCEL 2016, It launches and begins to execute, but fails when the embedded EXCEL VBA attempts to rename sheet. With the VBA code paused I can't manually rename the sheet either. If I stop the VBA the sheet will rename normally.
The workbook executes properly on that PC, if i launch it normallly and trigger event. Only during automation is the unwanted behaviour exibited.
basically the code in excel does this
make report in template sheet.
copy template sheet
rename copied sheet (code crashes on rename- tried not renaming see below)
add new sheet to array of sheet names
loop til done
print array of sheets to printer designated
delete sheets created during reporting (code crashes here as well - if i just let excel name them above)
I dorked with trust and macro and certificate but still no love...