DataSet XML and Excel

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
 
R

Rich P

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top