Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Leveling Methods build Excel Worksheet Functions 3 October 13th 07 12:44 AM
Std.Dev.methods NOT WORKING SixSpeedShifter Charts and Charting in Excel 1 July 20th 05 06:32 PM
Tabels and calculation methods Urban Excel Programming 3 December 12th 03 12:16 AM
Search Methods Dave Peterson[_3_] Excel Programming 0 July 11th 03 03:30 AM
Certain methods do not work Rohit Thomas Excel Programming 4 July 9th 03 06:36 PM


All times are GMT +1. The time now is 02:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"