- 帖子
- 34
- 主題
- 12
- 精華
- 0
- 積分
- 85
- 點名
- 0
- 作業系統
- xp
- 軟體版本
- office 2003
- 閱讀權限
- 20
- 註冊時間
- 2012-7-3
- 最後登錄
- 2013-6-4
|
產生多餘的名稱
請問各位大大
我執行底下這兩段程式,會定義多餘的名稱"2012_F3_1_10_1101.php?STK_NO=1101&myear=2012",且一直重覆定義,要如何讓他不用自動定義名稱
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.twse.com.tw/ch/trading/exchange/FMSRFK/genpage/Report" & year1 & "01/" & year1 & "_F3_1_10_" & stock_id & ".php?STK_NO=" & stock_id & "&myear=" & year1 & "" _
, Destination:=Range("A6"))
.Name = "2012_F3_1_10_1101.php?STK_NO=1101&myear=2012"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "8"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
..........................
...........................
..............................
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = [B2].Address Then
With Sheets("test")
If WorksheetFunction.CountIf(Sheets("Sheet3").Range("A2:A1425"), .[B2]) = 1 Then
Call test
Else
Call test3
End If
End With
End If
Application.EnableEvents = True
End Sub
謝謝幫忙 |
|