Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Any one know how to write a macro to export the object to excel or text file for Field trigger?I want to keep on exporting the data to same excel/text file created for any selection.I don't want to replace the file whenever different values in the field are selected.
Hi,
This is the macro:
sub CopyToXL2
set XLApp = CreateObject("Excel.Application")
XLApp.Visible = FALSE
set XLDoc = XLApp.Workbooks.Add
XLDoc.Sheets(1).name = "Supervisor Report"
set XLSheet = XLDoc.Worksheets(1)
set MyTable = ActiveDocument.GetSheetObject("CH02")
set XLSheet = XLDoc.Worksheets(1)
MyTable.CopyTableToClipboard true
XLSheet.Paste XLSheet.Range("A1")
XLDoc.SaveAs "C:\Users\igal\Documents\BU\MyRep.xlsx" 'Choose the file path you like
XLApp.Visible = False
XLApp.Quit
Set XLApp = Nothing
Set Table = Nothing
end sub
End then go to->Settings->Document Properties->Triggers->Field Event Trigger
See the attached.
Hope it help.
Thank you very much Yigal for quick response.I am not a macro person.The macro works good.But it is every time asking me whether to replace the old excel file or not? I want to add the data to the existing excel if another selection is made.And it also generates two sheets.One the object i needed and the other the selection table.I want only the object.Actually I am making a selection in one object and trying to export the data from another object based on the selection.I have read some where in community little bit similar to my question
http://community.qlik.com/message/200603
Can we use AppendExport also to do similar thing with the data exported to the same excel sheet whenever the field selected?
Hi Yigal I have attached your application with notes about how I want to do the export.
Hi,
If you want to export data to excel, the folowing article could be useful for you:
http://www.codeproject.com/KB/cs/Excel_PDF_Word_ExportWiz.aspx?msg=3768323#xx3768323xx