MS query links removal in VBA

  • Thread starter Thread starter Andrea
  • Start date Start date
A

Andrea

I created several queries to Access database in excel.
I want to remove the links to the queries adn jut leave
the data. I can do this manually by selecting Data range
properties from the Query menu, end deselecting Save
Query Definition.
Microsoft also gives out a file calles delllink.xla which
can do this through a wizard.
I need to do this in my own VBA code (I want to save non
linked versions of my excel file for traceability
reasons). Does anyone know how to do this in VAB, I could
not find the right property/method for the recordset
object type.
Thanks for your help,
Andrea
 
Hi Andrea,

If you look at the list of names in the workbook (Insert/Name/Create), you
should see items that are associated to your queries. As long as you don't
have any non-query related names, you can use the follwing to delete the
links when you are ready to close the workbook

Sub DeleteLinks
For i = ActiveWorkbook.Names.Count to 1
ActiveWorkbook.Names(i).Delete
Next i
End Sub

HTH, Greg
 
Back
Top