How to disable the save as prompt?

前端 未结 2 2097
没有蜡笔的小新
没有蜡笔的小新 2020-12-19 12:14

\"Error

        If IsWorkbookOpen(\"CONTRACT\\CONTRACTLIST_Cement.xlsx\") Then
            x          


        
2条回答
  •  借酒劲吻你
    2020-12-19 13:12

    Try below code

    Its always good to explcilty refer the workbook rather than ActiveWorkbook

    Sub test()
       If IsWorkbookOpen("CONTRACT\CONTRACTLIST_Cement.xlsx") Then
                x = 0
        Else
            Application.DisplayAlerts = False
            ThisWorkbook.Save
            ThisWorkbook.Close False
            Application.DisplayAlerts = True
        End If
    
    End Sub
    

提交回复
热议问题