[問題] Excel 匯入web 保留0 的方法
軟體:MS Excel
版本:2007
大家好!!
想請問一下,有沒有辦法用Excel 匯入網頁資料的時候把
數字格式轉成文字
在匯入Excel呢?
因為我把
http://www.emega.com.tw/js/StockTable.htm
這個網頁資料用匯入的方式
像台灣50原本它的代號是0050的
但是匯入以後,它的代號會變成50 而已
想必是因為Excel把它判定會數字的關係....
剛才用錄製的方法
把它的VBA 碼,錄下來了
希望有大大可以指點一二,感激不盡!!
Sub test()
'
' test Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.emega.com.tw/js/StockTable.htm",
Destination:=Range("$A$1"))
.Name = "StockTable"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.142.243.175
※ 文章網址: https://www.ptt.cc/bbs/Office/M.1434857092.A.058.html
→
06/21 13:08, , 1F
06/21 13:08, 1F
→
06/21 13:08, , 2F
06/21 13:08, 2F
→
06/21 13:09, , 3F
06/21 13:09, 3F
→
06/21 14:11, , 4F
06/21 14:11, 4F
→
06/21 14:12, , 5F
06/21 14:12, 5F
soyoso大哥用createobject("internetexplorer.application")的方式可以保留0了
但是又出現另外一個問題orz
就是它的儲存格裡面會多一個看不到的字元
我如果把那個字元刪除,0就會消失了....
而且那個字元我寫在vba裡面,它沒有辦法顯示說,vba裡面會顯示?
我原本用匯入的方式也是會有一個特殊字元
但是我錄製一個巨集,用取代的方式可以刪掉
用createobject("internetexplorer.application")的方式
錄製巨集,取代的方式沒有辦法刪掉
QQ
※ 編輯: TWCFP (223.142.243.175), 06/21/2015 15:24:28
→
06/21 16:53, , 6F
06/21 16:53, 6F
→
06/21 16:53, , 7F
06/21 16:53, 7F
→
06/21 16:59, , 8F
06/21 16:59, 8F
→
06/21 21:19, , 9F
06/21 21:19, 9F
→
06/21 21:19, , 10F
06/21 21:19, 10F
→
06/21 21:19, , 11F
06/21 21:19, 11F
→
06/21 21:19, , 12F
06/21 21:19, 12F
→
06/21 21:19, , 13F
06/21 21:19, 13F
→
06/21 21:19, , 14F
06/21 21:19, 14F
→
06/21 21:21, , 15F
06/21 21:21, 15F
→
06/21 21:21, , 16F
06/21 21:21, 16F
→
06/21 21:24, , 17F
06/21 21:24, 17F
Office 近期熱門文章
PTT數位生活區 即時熱門文章