作者samtien (山姆田)
站内Programming
标题[问题] VBA excel超连结的问题
时间Thu Apr 10 17:23:53 2008
excel有个web查询
我的档案格式如下
网址连结
网路上的内容
我想要更改网址连结的部分
然後就可以用一个巨集
1.删除原本的web查询
2.自动复制超连结里面的网址
3.把复制的网址再变成新的web查询
程式码如下
这是我手动录制下来再改的
不过run不过.........
卡在最後一行 .Refresh BackgroundQuery:=False
Sub Macro1()
Dim WebSite As String
WebSite = Sheets("晨星").Hyperlinks(20).Address
ActiveCell.Offset(1, 0).Range("A1:B8").Select
Selection.QueryTable.Delete
Selection.ClearContents
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;WebSite" _
, Destination:=Range("$A$232"))
.Name = "FundQT.asp?Country=HKG&Symbol=F0000001JD"
.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 = "23"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.175.177.115