Save As not saving a file

2019-08-03 15:46发布

I'm trying to get the 'Save As' dialogue to prompt with the inputted information on a userform and save as a new file. Everything looks like it works and even has the saving/loading icon when I click 'save' but no actual saved file is saved in my folder. Here is my 'Save As' code:

Dim IntialName As String
Dim fileSaveName As Variant
InitialName = Range("d1") & "_" & Range("j1") & "_" & Range("p1")
fileSaveName = Application.GetSaveAsFileName(InitialFileName:=InitialName, _
    fileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm") 

标签: excel vba
1条回答
在下西门庆
2楼-- · 2019-08-03 16:16

Add

ActiveWorkbook.SaveAs fileSaveName, xlFileFormat.xlOpenXMLWorkbookMacroEnabled

after your code to actually save it.

All your code currently does is give you a string so you can save it using that name. You have to do the actual saving yourself.

查看更多
登录 后发表回答