Sub cnv_html() fileSaveName = Application.GetSaveAsFilename("*.htm", "HTMLファイル (*.HTM), *.HTM", , "出力ファイル指定", "了解") ' If fileSaveName <> False Then ' MsgBox fileSaveName & "でセーブします。" ' End If Call Output(fileSaveName) End Sub Sub Output(filename) Dim xx, yy '選択範囲取得 'sheetname = Application.PreviousSelections(1).Select.Name sheetname = ActiveSheet.Name 'sheetname = "Sheet1" x0 = Selection.Columns(1).column y0 = Selection.Rows(1).row xx = Selection.Columns.Count yy = Selection.Rows.Count '出力ファイルオープン Open filename For Output As #1 ' Print #1, "" ' Print #1, "" Print #1, "" For y = y0 To yy + 1 Print #1, ""; For x = x0 To xx + 1 a$ = Sheets(sheetname).Cells(y, x) Print #1, ""; Next x Print #1, "" Next y Print #1, "
"; a$; "
" ' Print #1, "" ' Print #1, "" Close #1 End Sub