在 excel 中更改默认的另存为类型
change default save-as type in excel
我有一个宏模板文件。它显示另存为对话框,默认为“.xls”格式。我想将默认类型显示为“.xlsm”。我需要使用 vba 来完成。
请任何人帮助我解决这个问题。
提前致谢!!!
请参考以下代码。对我有用!!
Dim FileSaveAsName As Variant, intchoice As Integer
Static saveProcess As Boolean
If Not saveProcess Then
Application.EnableEvents = False
Application.DisplayAlerts = False
If SaveAsUI = True Then 'Save As... was selected
saveProcess = True
Set FileSaveName = Application.FileDialog(msoFileDialogSaveAs)
FileSaveName.InitialFileName = ThisWorkbook.Name
FileSaveName.FilterIndex = 2 'select to save with a ".xlsm" extension
intchoice = FileSaveName.Show
If intchoice <> 0 Then
FileSaveName.Execute
End If
Cancel = True
Else 'Normal Save
saveProcess = True
Cancel = True
ThisWorkbook.Save
End If
saveProcess = False
Application.EnableEvents = True
Application.DisplayAlerts = True
End If
我有一个宏模板文件。它显示另存为对话框,默认为“.xls”格式。我想将默认类型显示为“.xlsm”。我需要使用 vba 来完成。
请任何人帮助我解决这个问题。
提前致谢!!!
请参考以下代码。对我有用!!
Dim FileSaveAsName As Variant, intchoice As Integer
Static saveProcess As Boolean
If Not saveProcess Then
Application.EnableEvents = False
Application.DisplayAlerts = False
If SaveAsUI = True Then 'Save As... was selected
saveProcess = True
Set FileSaveName = Application.FileDialog(msoFileDialogSaveAs)
FileSaveName.InitialFileName = ThisWorkbook.Name
FileSaveName.FilterIndex = 2 'select to save with a ".xlsm" extension
intchoice = FileSaveName.Show
If intchoice <> 0 Then
FileSaveName.Execute
End If
Cancel = True
Else 'Normal Save
saveProcess = True
Cancel = True
ThisWorkbook.Save
End If
saveProcess = False
Application.EnableEvents = True
Application.DisplayAlerts = True
End If