查看積分策略說明發表回覆
Discuz! 代碼
提示插入
直接插入
說明訊息

插入粗體文本 插入斜體文本 插入下劃線 置中對齊 插入超級連結 插入信件位址 插入圖像 插入 flash 插入代碼 插入引言 插入列表
刪除線 直線分隔線 虛線分隔線
    
添加文字底框
內容 [字數檢查]:

表情符號

更多 Smilies
字型大小 |||
溫馨提示:本區開放遊客瀏覽。


文章關鍵字 : [功能說明]
(關鍵字可加強搜索準確性, 如關鍵字多於一組, 請以 , 作分隔, e.g. : 阿笨,shiuh,第一笨)

 關閉 URL 識別 | html 禁用
 關閉 表情符號 | 表情符號 可用
 關閉 Discuz! 代碼 | Discuz! 代碼 可用
使用個人簽名
接收新回覆信件通知
推薦放檔網絡空間

檔案(Torent, zip等)
  1. freedl
  2. multiupload
  3. btghost
  4. 便當狗
  5. mediafire
  6. pillowangel
圖片(JPG, GIF等)
  1. hotimg
  2. tinypic
  3. mousems2
  4. imageshack
  5. imm.io
>>>歡迎推薦好用空間


最新10篇文章回顧
XLOVER

 發表於 2012-6-2 08:56 AM

非常感謝大大的幫忙喔....
^^


陽だまり

 發表於 2012-6-1 07:45 PM

名叫number的string

Dim number As String
number = "請輸入代號,空白預設為2330"
number = InputBox(number)
If number = "" Then
number = "2330"
End If

With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://dj.mybank.com.tw/z/zc/zcp/zcpa/zcpa_" + number + ".asp.htm", Destination:=Range("$A$1"))
        .Name = "test"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlOverwriteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "3"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
[陽だまり 在  2012-6-1 07:48 PM 作了最後編輯]


XLOVER

 發表於 2012-6-1 06:05 PM

以下是一段VBA程式,
是要把股票代號2330的資料從網頁把它讀到Excel裡。

不知道程式要怎麼寫,
才能讓那個代號"2330"的部分,
由固定,改成可以由我自行輸入,
然後套用進去。

還請路過的大大幫幫忙....
謝謝囉....

=====

Sub test1()

With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://dj.mybank.com.tw/z/zc/zcp/zcpa/zcpa_2330.asp.htm", Destination:=Range("$A$1"))
        
        
        
        
        .Name = "test"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlOverwriteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "3"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With

End Sub





所在時區為 GMT+8, 現在時間是 2024-4-27 09:32 PM
清除 Cookies - 連絡我們 - TWed2k © 2001-2046 - 純文字版 - 說明
Discuz! 0.1 | Processed in 0.018500 second(s), 7 queries , Qzip disabled