• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA

KishorKK

Member
Hi All,

When i am trying to turn off display alerts off. It's not working even though if i put in true or false either the way it's not working. Please help me with this.

Sub test12()
Sheets("sheet2").Delete
Application.DisplayAlerts = True
End Sub


POST MOVED BY MOD
 
Last edited by a moderator:
You need to turn it off before your delete operation.

So...
Code:
Sub test12()
Application.DisplayAlerts = False
Sheets("sheet2").Delete
Application.DisplayAlerts = True
End Sub
 
That error shows up when you don't have Sheet2 present in your workbook.

You can either create error trap or check if sheet name is present, before running the code.
 
actually, my question is when i saving the file as save as and when i open again write some macro trying to save again taking file as save as. so like this so many files creating can't we write macros in single excel
 
By default it should allow you to save without creating new file. Is there some code you have in there that's interfering with it?

You may want to try cleaning resetting Personal Macro Workbook (if there is one).

Search for "Personal.xlsb" file in both system folder "C:\Program files(x86)\...\XLSTART" and in user folder (either in "C:\Documents and Settings\"user name"\Application Data\....\XLStart\" or "C:\Users\"user name"\AppData\Roaming\...\XLSTART").

Also, you can try resetting options to default.

EDIT: Just noticed you had ".xltm" extension for your file in the screen shot. That's Macro-Enabled template file. That's the issue. Save as ".xlsm" or ".xlsb".
 
Last edited:
Back
Top