1

I want users to get the option to save their workbook (if they have made any changes) at the beginning of my macro. How can I achieve this?

I've tried:

ThisWorkbook.Save

but unfortunately it doesn't generate any prompt.

I've also tried:

ThisWorkbook.Save(ThisWorkbook.FullName)

but it asks users if they are sure that they want to overwrite the existing file - so it gives a different prompt than the one I want.

4

1 回答 1

7

只需用您自己的提示包装它:

If Not ThisWorkbook.Saved Then 
    If MsgBox("Do you want to save the file before continuing?",vbYesNo,"Save?") = vbYes Then
        ThisWorkbook.Save
    End If
End If
于 2013-08-23T20:41:59.323 回答