View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VB way to remove the query from a Query Table?

cells.copy
Cells.PasteSpecial paste:=xlValues

will remove the query table as leave the data.

If you have other formulas on the sheet you don't want to lose, then just do
the area of the query table

With Activesheet.querytables(1).ResultRange
.copy
.pasteSpecial paste:=xlValues
End With




--
Regards,
Tom Ogilvy

"Toby Erkson" wrote in message
...
I have a workbook that uses a Query Table. When they click on a button

the
workbook is saved, minus various commandbuttons, their VB code, and the
Workbook_Open code (thank you Chip Pearson website!). I also want to make
sure that the Query Table now becomes static, that it does NOT update.

I tried using the macro recorder to capture the code necessary to remove

the
Query Table property of the dataset but that was a bust. I do have the
following code that successfully keeps the Query Table from updating

itself in
the static workbook:
Sheets("sheetname").QueryTables("querytablename"). EnableRefresh = False

Is there a VB way to basically clear the "Save query definition" checkbox

in
the "External Data Range Properties" window of a Query Table?

Thanks
--
Toby Erkson
Oregon, USA
Excel 2002 & 2003 in Windows XP