Prevent Overwrite Warning in VBA

前端 未结 2 1972
攒了一身酷
攒了一身酷 2021-01-21 18:34

I am writing a macro to extract XML data from a Web API into a spreadsheet. The first column contains two fields delimited with a comma so I have extended the macro to insert a

2条回答
  •  醉梦人生
    2021-01-21 19:15

    Application.DisplayAlerts = False
    

    Two important points from the documentation:

    [...] when a message requires a response, Microsoft Excel chooses the default response.

    and

    If you set [DisplayAlerts] to False, Microsoft Excel sets [it back] to True when the code is finished [...]

    meaning you'll still have the standard "Do you want to save before closing?" etc. prompts during normal Excel use.

提交回复
热议问题