Created
May 28, 2016 07:10
-
-
Save otaks/798cb3f5f0885eee9c05f954f844ae31 to your computer and use it in GitHub Desktop.
Module1.bas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub outputHtml() | |
Call outputList | |
Call outputAriticle | |
End Sub | |
Sub outputList() | |
strFileName = ThisWorkbook.Path + "\list.html" | |
' FreeFile値の取得(以降この値で入出力する) | |
intFF = FreeFile | |
' 指定ファイルをOPEN(出力モード) | |
Open strFileName For Output As #intFF ' ③ | |
' 2行目から開始 | |
GYO = 5 | |
' 最終行まで繰り返す | |
Print #intFF, "<html>" | |
Do Until Worksheets("用語集").Cells(GYO, 4).Value = "" | |
' A列内容をレコードにセット(先頭は2行目) | |
'strREC = Cells(GYO, 1).Value ' ④ | |
' レコード件数カウンタの加算 | |
'lngREC = lngREC + 1 | |
'xlAPP.StatusBar = "出力中です....(" & lngREC & "レコード目)" | |
' レコードを出力 | |
aa = Worksheets("用語集").Cells(GYO, 4).Value | |
Print #intFF, "<a href=""" + aa + ".html"" target=""migi"">" + aa + "</a><br>" | |
' 行を加算 | |
GYO = GYO + 1 | |
Loop | |
Print #intFF, "</html>" | |
' 指定ファイルをCLOSE | |
Close #intFF | |
End Sub | |
Sub outputAriticle() | |
' 2行目から開始 | |
GYO = 5 | |
Do Until Worksheets("用語集").Cells(GYO, 4).Value = "" | |
aa = Worksheets("用語集").Cells(GYO, 4).Value | |
bb = Worksheets("用語集").Cells(GYO, 5).Value | |
strFileName = ThisWorkbook.Path + "\" + aa + ".html" | |
' FreeFile値の取得(以降この値で入出力する) | |
intFF = FreeFile | |
' 指定ファイルをOPEN(出力モード) | |
Open strFileName For Output As #intFF ' ③ | |
Print #intFF, "<html><body>" | |
Print #intFF, "<h1>" + aa + "</h1>---------------------------------<br>" + setLink(bb) | |
' 行を加算 | |
GYO = GYO + 1 | |
Print #intFF, "</body></html>" | |
' 指定ファイルをCLOSE | |
Close #intFF | |
Loop | |
End Sub | |
Function setLink(bb) | |
GYO = 5 | |
Do Until Worksheets("用語集").Cells(GYO, 4).Value = "" | |
aa = Worksheets("用語集").Cells(GYO, 4).Value | |
If InStr(bb, aa) <> 0 Then | |
bb = Replace(bb, aa, "<a href=""" + aa + ".html"">" + aa + "</a>") | |
End If | |
GYO = GYO + 1 | |
Loop | |
setLink = bb | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment