매크로 기록을 시작하고 데이터 -> 웹에서 가져 오기 대화 상자에서 필요한 웹 페이지를 열고 필요한 테이블을 선택한 다음 필요에 따라 모든 가져 오기 옵션을 설정하고 데이터를 가져옵니다. 그런 다음 녹음을 중지하십시오.
자동 생성 된 매크로 코드가있는 보일러 플레이트가 생기면 원하는대로 바꿀 수 있습니다.
나는 여러 번했는데, 이것은 지금 당신과 함께 나누기 위해 저장하지 않았기 때문에 쉽습니다.
업데이트 : 이것은 당신이
Sub Macro1()
'
' Macro1 Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://stackoverflow.com/questions/18158928/get-tabledata-from-webpage-into-excel-using-macro/18160278#18160278" _
, Destination:=Range("$A$1"))
.Name = "18160278#18160278"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells ' adjust this setting to your needs
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "1" ' this is the number of the required table on a page
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
가 왜 VBA를 사용하여 '인터넷 익스플로러 응용 프로그램'을 만들려는 것이 페이지에서 질문 가져 오는 방법입니까? Excel은 이미'Data -> From Web' 옵션을 가지고 있습니다. – richie