View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default Break a link to a data source

asmenut

Me.Sheets(1).QueryTables(1).Delete

Change the 1's to fit your situation. This will delete the query table, but
the data will remain. See also

http://www.dicks-clicks.com/excel/Ex....htm#DeleteVBA

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"asmenut" wrote in message
...
I have a template that imports external data (OBDC) and/refreshes upon
startup. Once opened, the user saves the file as a differnent name (.xlt

to
.xls). When the user opens up the .xls, it automatically refreshes the

data
(problem if a new query was request from our MRP system).

Is there a way with VBA to break the data link once the file is saved as

an
.xls?

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As

Boolean)

Need code here

End Sub