Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Overwriting Existing File on Export Macro

Hi,

Currently i have the below script.  All it does, is exports a table from Qlikview.  However, i need Qlikview to REPLACE the existing file without a prompt from Excel.

XLDoc.DisplayAlerts = False does not work , because although it doesn't display it, it ends up not overwriting the file autmatically.

Please assist.

sub Export

set XLApp = CreateObject("Excel.Application")

XLApp.Visible = True 'you can make it false, if you want to make it in the background

set XLDoc = XLApp.Workbooks.Add

XLDoc.Sheets(1).name = "Export"

set XLSheet = XLDoc.Worksheets(1)

set MyTable = ActiveDocument.GetSheetObject("TB01") 'Change TB01 to the object you want to export to Excel (Object Properties > General tab > far right)

set XLSheet = XLDoc.Worksheets(1) 'Select sheet where data should be pasted

Mytable.CopyTableToClipboard true 'Copy data to Clipboard

XLSheet.Paste XLSheet.Range("A1") 'Paste data starting at A1

     XLDoc.DisplayAlerts = False

XLDoc.SaveAs "...............\Sequence.xlsx"

XLDoc.DisplayAlerts = True

End Sub

2 Replies
marcus_sommer

Try this:

...

XLApp.DisplayAlerts = False

XLDoc.SaveAs "Path\Sequence.xlsx"

XLApp.DisplayAlerts = True

...

- Marcus

Anonymous
Not applicable
Author

Thanks, I tried this before, seems I put it in the wrong place.  this worked perfect thanks.

Regards,