Imports System.IO Imports System.Xml Imports System.Xml.Xsl Namespace Framework Public Class Export Public oApp As Framework.App ' Export a dataset into an Excel spreadsheet ' expO1 DataSet ' expC1 Full path of the file to save ' expC2 Full path of the transformation stylesheet Public Function ExportToExcel(ByVal toDataSet As DataSet, ByVal tcFile As String, _ ByVal tcTransformationStyleSheet As String) As Boolean ' Read the dataset in a XmlDataDocument Dim loXmlDataDoc As XmlDataDocument = New XmlDataDocument(toDataSet) Dim loXslCompiledTransform As Xsl.XslCompiledTransform = New Xsl.XslCompiledTransform ' Get the Excel stylesheet into memory Dim loMemorySteam As New FileStream(tcTransformationStyleSheet, FileMode.Open, FileAccess.Read) Dim loXmlTextReader As XmlTextReader = New XmlTextReader(loMemorySteam) loXslCompiledTransform.Load(loXmlTextReader, Nothing, Nothing) Dim loStringWriter As New StringWriter() loXslCompiledTransform.Transform(loXmlDataDoc, Nothing, loStringWriter) ' Try to save the file If Not oApp.CreateFile(loStringWriter.ToString(), tcFile) Then Return False End If Return True End Function End Class End NamespaceA big thanks to all who provided help on this topic.