Sub ki031() fff = Application.GetOpenFilename(Title:="HTMLタグをチェックするファイル指定") If fff = "False" Then MsgBox "ファイルを1個指定して下さい" Exit Sub End If '拡張子 i = InStrRev(fff, ".") ext = Mid(fff, i) If InStr(1, ext, "htm", 1) = 0 Then MsgBox "拡張子「html」or「htm」以外は指定出来ません" Exit Sub End If phn1 = ActiveWorkbook.Path Sheets.Add FileCopy fff, phn1 & "\htmlcheck.txt" With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;" & phn1 & "\htmlcheck.txt", Destination:=Range("A1")) .Name = "htmlcheck" .RefreshStyle = xlInsertDeleteCells .RefreshPeriod = 0 .TextFilePlatform = xlWindows .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierNone .TextFileColumnDataTypes = Array(1) .Refresh BackgroundQuery:=False End With Kill phn1 & "\htmlcheck.txt" End Sub