Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Paste names from a source workbook to a destination | Excel Discussion (Misc queries) | |||
Destination range | Excel Discussion (Misc queries) | |||
Names not deleted until book closed | Excel Programming | |||
Some 'Names' cannot be deleted by Insert|Name|Define-Delete button | Excel Worksheet Functions | |||
Range names being deleted and altered | Excel Programming |