Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
For Each strFname In WScript.Arguments
Set objDoc = objExcel.Workbooks.Open(strFname)
' clear all names (comment out)
For Each N In objDoc.Names
'' N.Delete
Next
' clear all user style
For Each S In objDoc.Styles
If Not S.BuiltIn Then
n Error Resume Next
S.Delete
On Error GoTo 0
End If
Next
objDoc.Save
objDoc.Close
Set objDoc = Nothing
Next
objExcel.Quit
MsgBox "処理完了"
WScript.Quit
上記のプログラムを.vbsファイルとして保存してそのファイルにドラッグアンドドロップすることで起動します。
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
For Each strFname In WScript.Arguments
Set objDoc = objExcel.Workbooks.Open(strFname)
' clear all names (comment out)
For Each N In objDoc.Names
'' N.Delete
Next
' clear all user style
For Each S In objDoc.Styles
If Not S.BuiltIn Then
S.Delete
End If
Next
objDoc.Save
objDoc.Close
Set objDoc = Nothing
Next
objExcel.Quit