DataSet XML and Excel

  • Thread starter Thread starter Danilo
  • Start date Start date
D

Danilo

Hello all,
I write a procedure to import a dataset to a new spreadsheet excel..

xls = New Excel.Application
wbook = xls.Workbooks.Add
wbook.XmlMaps.Add(ds.GetXmlSchema, "NewDataSet")
sheet = wbook.Worksheets(1)
wbook.XmlImportXml(ds.GetXml, wbook.XmlMaps(1), True,
sheet.Range("A1"))

with the XmlImportXml function appears a message that warns that the
mapping data has not been found and then applied mapping on the basis
of data, how to remove this message ?

Danilo
 
try

xls = New Excel.Application
xls.DisplayAlerts = False <------- Add this line
wbook = xls.Workbooks.Add
wbook.XmlMaps.Add(ds.GetXmlSchema, "NewDataSet")
sheet = wbook.Worksheets(1)
wbook.XmlImportXml(ds.GetXml, wbook.XmlMaps(1), True,
sheet.Range("A1"))
xls.DisplayAlerts = True <------- reset

you may have to Ctype something - haven't tested this yet, but
application.DisplayAlerts is how you suppress messages in Excel.


Rich
 
Back
Top