如何另存为xlsx文件? [英] How to save as xlsx file?

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

问题描述

我的SaveFile子保存文件,但是当我尝试再次打开它时,Excel无法将其识别为Excel文件.

My SaveFile sub saves the file but when I try to open it again Excel doesn't recognize it as an Excel file.

如果我从桌面上右键单击文件并检查属性,则文件的类型为文件".我已经阅读了格式,但无法将此文件另存为xlsx格式.我能够使启用宏的excel文件正常工作,但这不是我想要的.

If I right click the file from my desktop and check the properties, the type of file is "File". I've read up on the formatting but can't get this file to save as an xlsx format. I was able to get a macro-enabled excel file to work properly but that's not what I want.

Sub SaveFile()

    MsgBox ("You will now be prompted to save your file") 'Notifies User 
    savename = Application.GetSaveAsFilename()  'Gets directory/name
    ActiveWorkbook.SaveAs Filename:=savename, FileFormat:=51 'Something is wrong 

End Sub

这是无格式"文件的图片

Here is the picture of the "Formatless" file

推荐答案

保存文件时,应使用扩展名保存文件:

When saving the file you should save it with its extension:

Sub SaveFile()

    savename = Application.GetSaveAsFilename(fileFilter:="Exel Files (*.xlsx), *.xlsx") 
    ActiveWorkbook.SaveAs Filename:=savename, FileFormat:=51 

End Sub

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

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