![]() |
Collection methods
How do I delete all the elements in a collection? (Specifically, the
QueryTables collection, but I don't know if that matters). You'd think this would be trivial, but Excel's VBA help is a horrific unmitigated disaster. -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. |
Collection methods
N ever used QueryTables, but to clear from a collection you would normally
use For Each ws in Activeworkbook For Each qyt In ws.QueryTables qyt.Delete Next qty Next ws -- HTH RP (remove nothere from the email address if mailing direct) "Christopher Benson-Manica" wrote in message ... How do I delete all the elements in a collection? (Specifically, the QueryTables collection, but I don't know if that matters). You'd think this would be trivial, but Excel's VBA help is a horrific unmitigated disaster. -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. |
Collection methods
Dim qt as QueryTable
for each qt in Activesheet.QueryTables qt.Delete Next -- Regards, Tom Ogilvy "Christopher Benson-Manica" wrote in message ... How do I delete all the elements in a collection? (Specifically, the QueryTables collection, but I don't know if that matters). You'd think this would be trivial, but Excel's VBA help is a horrific unmitigated disaster. -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. |
Collection methods
Bob Phillips spoke thus:
For Each ws in Activeworkbook For Each qyt In ws.QueryTables qyt.Delete I see. Now, if Excel's help could have told me that... I know now that collections have a Count property, but where could I have found that information, say, on MSDN or the VBA help...? Next qty Next ws -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. |
Collection methods
Look in the object browser in Excel VBA.
-- Regards, Tom Ogilvy "Christopher Benson-Manica" wrote in message ... Bob Phillips spoke thus: For Each ws in Activeworkbook For Each qyt In ws.QueryTables qyt.Delete I see. Now, if Excel's help could have told me that... I know now that collections have a Count property, but where could I have found that information, say, on MSDN or the VBA help...? Next qty Next ws -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome. |
All times are GMT +1. The time now is 01:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com