Guys,

I am getting this error when trying to set DisplayAlerts in excel to false. This has been working fine for months, why would it suddenly stop working ? It still creates the excel document OK after this error.

Thanks
Bob

Error: QueryInterface for interface Microsoft.Office.Interop.Excel._Application failed.
Err No:13Stack Trace:
at Microsoft.Office.Interop.Excel.ApplicationClass.set_DisplayAlerts(Boolean RHS)

This is my code that gets Excel....

VB Code:
  1. Dim xl As Excel.Application
  2.             Try
  3.  
  4.                 Try
  5.                     xl = GetObject(, "Excel.Application")
  6.                 Catch ex As Exception
  7.                     xl = New Excel.Application
  8.                 End Try
  9.  
  10.                 Dim wkbk As Excel.Workbook
  11.                 Dim wkst As Excel.Worksheet
  12.                 xl.DisplayAlerts = False 'FAILS HERE ####
  13.                 xl.Visible = False
  14.                 Dim docpath As String
  15.  
  16.                 wkbk = xl.Workbooks.Open(TemplateLocation)
  17.                 wkst = wkbk.Sheets(1)