LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Destination Range Names to be deleted.


Hi,
First of all I, would like to thanks this Excel Forum Team. Recently I
have joined this Forum. It is absolutely magestic. It helped me a lot.
With the help of this forum I've created a web query table. Now the
problem is, whenever I refresh the query, it generates the query name
automatically like : "ExternalData_1", after next refreshment -
"ExternalData_2" & so on. Till this time it has been created almost 183
names ("ExternalData_183"). Manually I've deleted all the names by
following steps :
From Menu - Insert Name select name Delete.
Now i wish to delete the previous name or overwrite the previous name,
whenever I, refresh the query table. I've checked lots of threads in
this regard & tried accordingly, but it did'nt worked for me. For the
ready reference, here is the codes :
Private Sub GetWebData()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim ws3 As Worksheet
Dim strName As String
Dim strNewEntry As String
Dim qtbQTb As QueryTable

Set ws1 = ThisWorkbook.Worksheets("Summery")
Set ws2 = ThisWorkbook.Worksheets("WebPage")
Set ws3 = ThisWorkbook.Worksheets("Dbase")

With ws2
If .QueryTables.Count < 0 Then
For Each qtbQTb In .QueryTables
If qtbQTb.Name = strName Then
On Error Resume Next
ws2.Range("A1:L184").ClearContents
On Error Resume Next
qtbQTb.Delete
On Error Resume Next
..Names(strName).Delete
On Error GoTo 0
End If
Next qtbQTb
End If
End With
With ws2.QueryTables.Add(Connection:= _
"URL;http://mvc.serviesin.com, Destination:=ws2.Range( _
"A1"))
..Name = strName
..FieldNames = True
..RowNumbers = False
..FillAdjacentFormulas = True
..PreserveFormatting = True
..RefreshOnFileOpen = False
..BackgroundQuery = True
..RefreshStyle = xlOverwriteCells
..SavePassword = True
..SaveData = False
..AdjustColumnWidth = True
..RefreshPeriod = 0
'.WebSelectionType = xlEntirePage
'.WebFormatting = xlWebFormattingNone
'.WebPreFormattedTextToColumns = True
'.WebConsecutiveDelimitersAsOne = True
'.WebSingleBlockTextImport = False
'.WebDisableDateRecognition = False
'.WebDisableRedirections = False
..Refresh BackgroundQuery:=False
End With
End sub

Any help in this regard will be highly appreciated.

Gur Vikram


--
Guru Vikram
------------------------------------------------------------------------
Guru Vikram's Profile: http://www.excelforum.com/member.php...o&userid=36404
View this thread: http://www.excelforum.com/showthread...hreadid=564171

 
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
Paste names from a source workbook to a destination kerfloo Excel Discussion (Misc queries) 0 January 31st 08 04:55 PM
Destination range marpetban Excel Discussion (Misc queries) 0 July 5th 06 02:51 PM
Names not deleted until book closed [email protected] Excel Programming 1 February 21st 06 05:55 PM
Some 'Names' cannot be deleted by Insert|Name|Define-Delete button David Iacoponi Excel Worksheet Functions 1 October 20th 05 09:03 PM
Range names being deleted and altered Todd Huttenstine[_2_] Excel Programming 3 November 30th 03 09:18 AM


All times are GMT +1. The time now is 11:38 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"