I am using MS Office on Mac and I need to enumerate files in a folder and insert them as pictures.
The problem is that the file names contain Unicode characters, and as I am on Mac I cannot use FileSystemObject library and Dir()
function doesn't work with Unicode characters.
Example file names:
HCLL20220419 色块 50x65cm-效果图.jpg
HCLL20220424-2 抽象画 50x65cm-效果图.jpg
This code does not work because Dir
cannot handle these file names:
Sub insertimages()
Dim fname As String
Dim pathtomyfolder As String
pathtomyfolder = "Path to my folder"
fname = Dir(pathtomyfolder)
While fname <> ""
ActiveWorkbook.Worksheets("Sheet1").Pictures.insert(pathtofolder & Application.PathSeparator & fname).Select
fname = Dir()
Wend
End Sub