overwrite existing file excel vba

混江龙づ霸主 提交于 2020-06-18 11:46:06

问题


open_book.SaveAs Filename:="E:\MF\data\" & com_tick_ask & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

This is my code to save a file as xlsx but I want to overwrite an existing file. and close this workbook. Can anyone help...


回答1:


Sorry friends for trouble. I got an answer.

I just have to put this line of code immediately before my SaveAs statement...

Application.DisplayAlerts = False

and have to put this line of code immediately after it...

Application.DisplayAlerts = True

e.g.

Application.DisplayAlerts = False
open_book.SaveAs Filename:="E:\MF\data\" & com_tick_ask & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = True


来源:https://stackoverflow.com/questions/36542088/overwrite-existing-file-excel-vba

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!