开发者

Way to convert from .xls to .xlsm via a batch file or vba?

开发者 https://www.devze.com 2023-03-30 19:24 出处:网络
How to I automate the conversion 开发者_开发百科of .xls workbooks to .xlsm?You can try this code:

How to I automate the conversion 开发者_开发百科of .xls workbooks to .xlsm?


You can try this code:

Sub TrandformAllXLSFilesToXLSM()
Dim myPath As String

myPath = "C:\Excel\"
WorkFile = Dir(myPath & "*.xls")

Do While WorkFile <> ""
    If Right(WorkFile, 4) <> "xlsm" Then
        Workbooks.Open FileName:=myPath & WorkFile
        ActiveWorkbook.SaveAs FileName:= _
        myPath & WorkFile & "m", FileFormat:= _
        xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
        ActiveWorkbook.Close
     End If
     WorkFile = Dir()
Loop
End Sub

See this thread for more info

0

精彩评论

暂无评论...
验证码 换一张
取 消