- ©«¤l
- 81
- ¥DÃD
- 31
- ºëµØ
- 0
- ¿n¤À
- 117
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2013-8-3
- ³Ì«áµn¿ý
- 2024-4-30
|
[µ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)
|