マークダウンファイル生成スクリプト修正

This commit is contained in:
2026-04-08 15:39:56 +09:00
parent 3854cdf6d7
commit 52f6ea2c52
4 changed files with 29 additions and 15 deletions

View File

@@ -7,7 +7,7 @@ Sub ExportCustomizeFunctionsToMarkdownFile()
Set ws = Worksheets("カスタマイズ機能")
Dim lastRow As Long
lastRow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row
lastRow = ws.Cells(ws.Rows.Count, "C").End(xlUp).row
Dim md As String
Dim funcCounter As Long
@@ -39,7 +39,7 @@ Sub ExportCustomizeFunctionsToMarkdownFile()
Exit Sub
End If
startRow = headerCell.Row + 1
startRow = headerCell.row + 1
For r = startRow To lastRow
' ここに既存の処理
@@ -124,7 +124,7 @@ Sub ExportCustomizeFunctionsToMarkdownFile()
' 先頭のスペース/矢印をカウント
For pos = 1 To Len(lineText)
ch = Mid(lineText, pos, 1)
If ch = " " Or ch = " " Or ch = "→" Then
If ch = " " Or ch = " " Or ch = "→" Or ch = "・" Then
indentLevel = indentLevel + 1
Else
Exit For
@@ -176,15 +176,20 @@ Sub ExportCustomizeFunctionsToMarkdownFile()
'========================
' Markdownファイル出力
'========================
Dim fso As Object, file As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim stream As Object
Set stream = CreateObject("ADODB.Stream")
Dim path As String
path = ThisWorkbook.path & "\CustomizeFunctions.md"
Set file = fso.CreateTextFile(path, True, True) ' UTF-8
file.Write md
file.Close
With stream
.Type = 2 ' adTypeText
.Charset = "UTF-8" ' ★ UTF-8指定
.Open
.WriteText md
.SaveToFile path, 2 ' adSaveCreateOverWrite
.Close
End With
MsgBox "Markdownファイルを出力しました" & vbCrLf & path, vbInformation
@@ -192,3 +197,4 @@ End Sub