Skip to main content
Marching toward a simplified navigation! READ ON
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Overwriting Existing File on Export Macro


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

Try this:


XLApp.DisplayAlerts = False

XLDoc.SaveAs "Path\Sequence.xlsx"

XLApp.DisplayAlerts = True


- Marcus

Not applicable

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