ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ·Q½Ð°Ý¤@­Óºô­¶¶×¤J¸ê®Æªº°ÝÃD

[µo°Ý] ·Q½Ð°Ý¤@­Óºô­¶¶×¤J¸ê®Æªº°ÝÃD

·Q½Ð°Ý¤@­Óºô­¶¶×¤J¸ê®Æªº°ÝÃD
------------------------------------------------------------------------
Sub ¥¨¶°2()
Dim a As Integer
Dim web1 As String
Dim stockCode As String

' ±q A1 Àx¦s®æÀò¨úªÑ²¼¥N½X
stockCode = Worksheets("¤u§@ªí1").Range("A1").Value

' Àˬd stockCode ¬O§_¬°ªÅ
If stockCode = "" Then
    MsgBox "Àx¦s®æ A1 ¬OªÅªº¡A½Ð¿é¤J¤@­ÓªÑ²¼¥N½X¡C"
    Exit Sub
End If

web1 = "URL;https://fubon-ebrokerdj.fbs.com.tw/z/zc/zcq/zcqa/zcqa_8913.djhtm"

' ¨Ï¥Î Replace ¨ç¼Æ´À´« URL ¤¤ªºªÑ²¼¥N½X
web1 = Replace(web1, "2881", stockCode)

' ²M°£¯S©w½d³òªº¤º®e
Range("C8:az120").Clear

' Ãö³¬°Å¤U/½Æ»s¼Ò¦¡
Application.CutCopyMode = False

' ±qºô­¶§ì¨ú¼Æ¾Ú¨Ã±N¨ä©ñ¤J Excel ¤u§@ªí¤¤
With ActiveSheet.QueryTables.Add(Connection:=web1, Destination:=Range("$C$8"))
    .Name = "zcq0.djhtm?b_A_a_" & stockCode & "_2"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .WebSelectionType = xlSpecifiedTables
    .WebFormatting = xlWebFormattingNone
    .WebTables = """oMainTable"""
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
End With
End Sub

---------------------------------------------------------------------------------------
stockCode = Worksheets("¤u§@ªí1").Range("A1").Value
³o¤@¦ê¤å¦r~~·í§Ú¨Ï¥ÎªÑ²¼½s¸¹®É~~·|¥¿±`¶×¤J
¦ý¬O·í§Ú¨Ï¥ÎWorksheets("¤u§@ªí1").Range("A1").Value~~ªº®É­Ô~«oµLªk¶×¤J(ªÅ¥Õ)
°ÝÃD¨ì©³¬O¤°»ò©O?

¸Ó¸ê®Æºô­¶¦³¤U©Ô¿ï³æ~~³o·|¦³¼vÅT¶Ü?

test.rar (31.63 KB)

web1 = "URL;https://fubon-ebrokerdj.fbs.com.tw/z/zc/zcq/zcqa/zcqa_8913.djhtm"

' ¨Ï¥Î Replace ¨ç¼Æ´À´« URL ¤¤ªºªÑ²¼¥N½X
web1 = Replace(web1, "2881", stockCode)

´À´«½X¤£¬Û¦P???

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦pÆp¥Û¡j®É¶¡¹ï¤@­Ó¦³´¼¼zªº¤H¦Ó¨¥¡A´N¦pÆp¥Û¯ë¬Ã¶Q¡F¦ý¹ï·M¤H¨Ó»¡¡A«o¹³¬O¤@§âªd¤g¡A¤@ÂI»ù­È¤]¨S¦³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD