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

[µo°Ý] ACCESSºô­¶¤W§ì¨ú¸ê®Æ

¦^´_ 5# HSIEN6001
¯à§_¤]±H¤@¥÷µ¹§Ú¡AÅv­­¤£°÷¨S¿ìªk¤U¸ü
³Ìªñ­n¶i¦æ¬ÛÃöªº±Ð¾Ç¡A¥¿¦b­W´o¤¤
ÁÂÁÂ
[email protected]

TOP

¥»©«³Ì«á¥Ñ HSIEN6001 ©ó 2012-5-30 10:48 ½s¿è

¦^´_ 11# losson

ÀɮקR¤F,¨S¯d
¦Ó¥B¨ºÀÉ®×¥u¬O´£¨Ñ·§©À,¦p¥|¼Óªº¹ÏÀÉ,¤À¦¨¨â°Ï¶ô¬d¸ß--->¥H¬Û¦PÄæ¦ì¦WºÙ
¶×¥X¨â­ÓÀɮ׫á,¦A­«·s¶×¤J¤@­Ó·sªí®æ§Y¥i
¨Ï¥ÎªÌ¥²¶·¦Û¦æ¦b¬d¸ß¤¤³]©w¿z¿ï,§âªÅ¥Õor¦h¾lÄæ¦ì¥h±¼

Access¶×¤J:
DoCmd.TransferText acImportDelim, "TEST ¶×¤J³W®æ", "¸ê®ÆªíÀɦW", CurrentProject.Path & "\TEST.txt",True     '¡° True(¦³Äæ¦ì¦WºÙ)False(µLÄæ¦WºÙ)
DoCmd.TransferSpreadsheet acImport, "³W®æ¥N¸¹", "¸ê®ÆªíÀɦW", ¸ô®|\ÀɦW.®æ¦¡, True                                   '¡° True(¦³Äæ¦ì¦WºÙ)False(µLÄæ¦WºÙ)

Access¬d¸ß¶×¥X:
DoCmd.OutputTo acQuery, "¬d¸ßªíÀɦW", 8, "¸ô®|\ÀɦW.xls", False        '¡°  False¶×¥X¬dªí.xls¤£¶}±Ò,True¶×¥X«á¶}±Ò¤å¥ó


¤]¥i¥H¦bExcelªí®æ¤¤¥ý³B²z¦n,¦A¶×¤JAccess

TOP

With .QueryTables.Add(Connection:="URL;http://bsr.twse.com.tw/bshtm/bshtm_report_
¬OÄÝ©óExcel¤U¸ü¬d¸ß¡MAccess¤£¯à¥Î

TOP

¦bAccess¤¤¥i¥ÎMicrosoft.XMLHTTP¤U¸ü¡M¦p¤U¦C
   Dim MSXML As Object
   Set MSXML = CreateObject("Microsoft.XMLHTTP")
   strWebsite="http://bsr.twse.com.tw/bshtm/bshtm_report_Messages.aspx?strDate=20121203&StartNumber=1101"
   MSXML.Open "GET", strWebsite, False
   MSXML.SetRequestHeader "Content-type", "text/xml"
   MSXML.send

TOP

¥¿¦n¬O§Ú·Q­n§äªº, ·PÁ§AµL¨pªº¤À¨É

TOP

¦^´_ 14# 048101
´£¨ÑªºURL¤£Work¡A¸Õ¸Õ§Úªº½d¨Ò¡A¿é¥X¬°html®æ¦¡¡C
¶È°w¹ï2330¥x¿n¹q´ú¸Õ(PageCount=13)¡A¨ä¥LªÑ²¼»Ý³]©wPageCount¡A¥i¤Wºô¬d¤@¤U¤W¥«¶R½æ¤é³øªí¬d¸ß¤U¸üªº¬ÛÃöµ{¦¡§Þ¥©¡C

Option Compare Database
Sub Test()

   Dim MSXML As Object
   Set MSXML = CreateObject("Microsoft.XMLHTTP")
   fh = FreeFile
   'strWebsite = "http://bsr.twse.com.tw/bshtm/bshtm_report_Messages.aspx?strDate=20140227&StartNumber=2330"
   strWebsite = "http://bsr.twse.com.tw/bshtm/bsMenu.aspx?HiddenField_page=PAGE_BS&HiddenField_spDate=&__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=%2FwEPDwUKLTQzNzI3ODE3MQ9kFgICAQ9kFhQCBQ8WAh4JaW5uZXJodG1sBQoyMDE0LzAyLzI3ZAIGDxYCHwAFCDIwMTQwMjI3ZAIIDw8WBh4JRm9udF9Cb2xkZx4EXyFTQgKEEB4JRm9yZUNvbG9yCj1kZAIKD2QWBAIBDw9kFgIeB09uQ2xpY2sFHGphdmFzY3JpcHQ6YnV0Q2xlYXJfQ2xpY2soKTtkAgcPFgIeBXN0eWxlBQlkaXNwbGF5OjsWAmYPZBYCZg9kFgICAQ8WAh8ABQIxM2QCDA8PFgYfAWgfAgKEEB8DCkdkZAIODw8WAh4HVmlzaWJsZWhkZAIQDw8WBh8BaB8CAoQQHwMKR2RkAhIPFgIfAGVkAhQPFgIfAGVkAhUPFgIfAAUCMTNkZJhG1J6ISYtK7kIpEfImJdIAAAAA&__EVENTVALIDATION=%2FwEWCQLryNa%2BCwLjpuXcAwKN4Ij0CwLB5ZfoCQLjk6TKBwKY8en5CwLdkpmPAQL6n7vzCwLAhrvLBScjE4xZjzHjsp%2FT1DwVl9MAAAAA&HiddenField_spDate=20140227&HiddenField_page=PAGE_BS&txtTASKNO=2330&hidTASKNO=2330&btnOK=%E6%9F%A5%E8%A9%A2"
   MSXML.Open "POST", strWebsite, False
   strWebsite = "http://bsr.twse.com.tw/bshtm/bsContent.aspx?StartNumber=2330&FocusIndex=All_13"
   MSXML.Open "GET", strWebsite, False
   MSXML.SetRequestHeader "Content-type", "text/xml"
   MSXML.send
   strpageContent = MSXML.responseText
   ' Save html as text/xml
   Open "C:\myStock\AccessVBA-2330.txt" For Output As #FreeFile
   Print #fh, strpageContent
   Set MSXML = Nothing
   Close #fh
   
End Sub
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬O­Ó¤p§¾«Ä¡I

TOP

¸É#16ªº¹Ï¡A¦³¹Ï¤~¦³¯u¶H¡I
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬O­Ó¤p§¾«Ä¡I

TOP

        ÀR«ä¦Û¦b : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD