Change all querytable in an Excel File
A quick way to change, for instance, the name of a table in each query of a file:
Dim q As QueryTableDim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
For Each q In ws.QueryTables
q.CommandText = Replace(q.CommandText,"MaChaine", "MaNouvelleChaine")
Next
Next
Of course dont forget to deeply test the result!
Thanks to "ADE" on
microsoft.public.fr.officexp who ask the question.
That's all folks!