Disable all "Refresh Data on File open"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,

I have an excel workbook with 3 sheets,

And in sheet there are more than 5 queries.

When my start macro, it saves the workbook in a new file name.

And in this position, I want to disable all queris. The queries can be
deleted, the "refresh data on file open" can be diabled... Whatever the
solution is, I don't want to see any info box about enabling or disabling the
queries when i open the new file.

Can you please help me?

Kindest regards,
 
Sub ClearAllQueries()
Dim ws As Worksheet
Dim qt As QueryTable

For Each ws In ActiveWorkbook.Worksheets
For Each qt In ws.QueryTables
qt.Delete
Next qt
Next ws
End Sub

HTH
 
Dear Ardus,

That works great!!

Thank you...

Ardus Petus said:
Sub ClearAllQueries()
Dim ws As Worksheet
Dim qt As QueryTable

For Each ws In ActiveWorkbook.Worksheets
For Each qt In ws.QueryTables
qt.Delete
Next qt
Next ws
End Sub

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top