Sub ConvertAllMdToHtml()
Dim fso As Object
Dim folderPath As String
Dim file As Object
Dim mdFilePath As String
Dim htmlFilePath As String
Dim command As String
Set fso = CreateObject("Scripting.FileSystemObject")
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select Folder Containing .md Files"
.AllowMultiSelect = False
If .Show <> -1 Then Exit Sub
folderPath = .SelectedItems.Item(1)
End With
If Right(folderPath, 1) <> "\" Then folderPath = folderPath & "\"
For Each file In fso.GetFolder(folderPath).Files
If LCase(fso.GetExtensionName(file.Name)) = "md" Then
mdFilePath = file.Path
htmlFilePath = fso.GetParentFolderName(mdFilePath) & "\" & fso.GetBaseName(mdFilePath) & ".html"
' Build Pandoc command
command = "cmd /c pandoc """ & mdFilePath & """ -f markdown -t html -s -o """ & htmlFilePath & """"
Shell command, vbHide
End If
Next
MsgBox "All .md files converted to HTML!", vbInformation
End Sub
Wednesday, June 24, 2026
VBA Word - Convert each Markdown (MD file into HTML
Install Pandoc (free, command-line tool) to run this VBA code to convert each Markdown (MD file into HTML.
Subscribe to:
Post Comments (Atom)
Hot Topics
-
In previous post , we learnt basic introduction to SQL Server . In this post we will learn about SSMS (SQL Server Management Studio) softwar...
-
In the previous post we have learnt about SSMS (SQL Server Management Studio) and how to connect with a SQL Server instance. In this post w...
-
By Ajeet Kumar RADAR CHART In radar chart, the categorical variable is displayed as spikes radiating from a central point. The values o...
No comments:
Post a Comment