Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Goodmorning,
first question: I would like to export a report to xls, I'm using the following macro:
Sub gimo
'Set the path where the excel will be saved
filePath = "C:\gimo.xls"
'Create the Excel spreadsheet
Set excelFile = CreateObject("Excel.Application")
excelFile.Visible = true
'Create the WorkBook
Set curWorkBook = excelFile.WorkBooks.Add
'Create the Sheet
Set curSheet = curWorkBook.WorkSheets(1)
'Get the chart we want to export
Set tableToExport = ActiveDocument.GetSheetObject("CH558")
Set chartProperties = tableToExport.GetProperties
tableToExport.CopyTableToClipboard true
'Get the caption
chartCaption = tableToExport.GetCaption.Name.v
'MsgBox chartCaption
'Set the first cell with the caption
curSheet.Range("A1") = chartCaption
'Paste the rest of the chart
curSheet.Paste curSheet.Range("A2")
'Save the file and quit excel
excelFile.Visible = false
excelFile.DisplayAlerts = False
curWorkBook.Close
excelFile.Quit
'Cleanup
Set curWorkBook = nothing
Set excelFile = nothing
'XLApp.Quit
End Sub
It looks working, I mean no errors, but it doesn't save any "gimo.xls".
Any idea?