excel VBA question, pls help !

2009-02-24 7:36 am
想做一個vba 做 web 資料查詢, 做十次, 每次輸入一個名稱或號碼, 共做十次web 資料查詢, 但下面個program 有問題,我將 myname 放入URL 度唔得, 應該點改??

Sub Macro1()

for i = 1 to 10
myname = Application.InputBox("enter name")

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.abcefg.com/web/code=myname" _
, Destination:=Range("A"& i))
.Name = ......
.FieldNames = ......

' 省略......

End With
next i
End Sub
更新1:

個網址變左呢個 , 而唔係我係inputbox 入既資料, 所以做唔到想要效果. URL;http://www.abcefg.com/web/code=myname

回答 (2)

2009-03-04 2:04 am
✔ 最佳答案
試試將
"URL;http://www.abcefg.com/web/code=myname" _
改為
"URL;http://www.abcefg.com/web/code=" & myname _


2009-02-28 5:19 am
Pls give me few working examples, that is, a proper link and what no. you're going to input or I can't test it for you. I'll reply to you asap if you can provide the said inforamation for my testing, thanks.


Calvin Lee
http://itvalueadded.blogspot.com
[email protected]


收錄日期: 2021-05-01 16:26:31
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20090223000051KK02571

檢視 Wayback Machine 備份