1. FAQ
  2. 엑셀(Excel)
  3. AfterEffects
  4. Premiere
  5. Photoshop
  6. ETC

이 게시판은 아별닷컴 회원만 질문을 올릴 수 있습니다. 회원에게 주어지는 특권인셈이지요. 회원이 아닌 분들은 열람만 가능합니다.

[레벨:30]아별

2009.12.16 18:19

아래 코드를 사용해보세요.

Excel 2003, 2007, 2010 모두에서 테스트해본 결과 모두 잘 돌아갑니다.

 

 Sub webQueryKofiabond()
    Dim strURL As String
    Dim strTargetDate As String
   
    strTargetDate = Format(DateAdd("D", -1, Date), "yyyymmdd")
   
    strURL = "URL;http://www.kofiabond.or.kr/SGPG/SGPG_mtrs_1.asp?start_date="
    strURL = strURL & strTargetDate
   
    With ActiveSheet.QueryTables.Add(Connection:=strURL, Destination:=Range("A1"))
        .Name = "SGPG_mtrs_1.asp?start_date=" & strTargetDate
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = """tDownload"""
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
End Sub

문서 첨부 제한 : 0Byte/ 2.00MB
파일 제한 크기 : 2.00MB (허용 확장자 : *.*)