另存为不保存文件 [英] Save As not saving a file

查看:44
本文介绍了另存为不保存文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取另存为"对话框,以在用户表单上提示输入的信息并另存为新文件.当我单击保存"时,一切看起来都正常,甚至具有保存/加载图标,但文件夹中没有保存任何实际的已保存文件.这是我的另存为"代码:

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") 

推荐答案

添加

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.

这篇关于另存为不保存文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆