- ©«¤l
- 9
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 63
- ÂI¦W
- 0
- §@·~¨t²Î
- WINDONW
- ³nÅ骩¥»
- 8
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-12-13
- ³Ì«áµn¿ý
- 2024-1-3
|
[µo°Ý] ½Ð°ÝþÃä¼g¿ù¦³°ÝÃDµLªkµn¤Jºô¶
½Ð°ÝþÃä¼g¿ù¦³°ÝÃDµLªkµn¤Jºô¶
Sub ¥¨¶°2()
'
' ¥¨¶°2 ¥¨¶°
'
Dim Http As Object
Dim Username As String, Password As String
Dim Url As String, Data As String
' ³]©w±b¸¹©M±K½X
Username = "***@gmail.com"
Password = "***"
' ³]©w¥Ø¼Ðºô¶ªºURL©MPOST¸ê®Æ
Url = "https://thefew.tw/login"
Data = "username=" & Username & "&password=" & Password
' «Ø¥ßXMLHttpRequestª«¥ó
Set Http = CreateObject("MSXML2.XMLHTTP")
' ³]©w½Ð¨D°Ñ¼Æ
Http.Open "POST", Url, False
Http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
' ¶Ç°e½Ð¨D
Http.send Data
' Àˬd¦^À³ª¬ºA½X¡A¦pªG¬O200ªí¥Üµn¤J¦¨¥\
If Http.Status = 200 Then
' µn¤J¦¨¥\«á¡A±z¥i¥H¨Ï¥ÎXMLHttpRequestª«¥ó¤U¸ü©Ò»Ýªº¸ê®Æ
' ...
Else
MsgBox "µn¤J¥¢±Ñ"
End If
' ³]©w±b¸¹©M±K½X
With ActiveSheet.QueryTables.Add(Connection:="URL;https://thefew.tw/cb", _
Destination:=Range("$A$1"))
' .CommandType = 0
.Name = "cb"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Function |
|