DoCmd.SetWarnings - In Excel instead of Access

mab9

New Member
Joined
Apr 11, 2006
Messages
31
Hi,

I've used the DoCmd.SetWarnings = FALSE command in Access to prevent error messages from popping up & I'd like to do the same in Excel. Is there a simliar code line for this?

Thanks!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Perhaps this at the start of the code.
Code:
Application.DisplayAlerts = False
And this at the end.
Code:
Application.DisplayAlerts = True
By the way DoCmd.SetWarnings isn't for preventing error messages, it's to suppress the messages you get when say running an update query.
 

mab9

New Member
Joined
Apr 11, 2006
Messages
31
I already have the display alerts as false at the start.

Regarding DoCmd, thats probably right. I was using it to prevent an append query error msg from showing up.

The issue I'm trying to get here is there is some code that was written in Excel2003, but some users are still on 2000. The crux of the program works, except for 1 piece and I'd rather the code not pop up all kinds of errors when it gets to that point.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
If it really is an error message you want to suppress then you should probably try and eliminate the error.

You could do that 2 ways.

1 Fix the code so it doesn't error.

2 Use error handling eg On Error Resume Next.

Personally I would recommend option 1.
 

mab9

New Member
Joined
Apr 11, 2006
Messages
31

ADVERTISEMENT

Well in this case, its not an error, its Excel2000 not recognizing one line of code that is being used on the 2003 machines.

I'll try the 2nd
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Well that sounds like an error to me.:)

Can you post the offending code?

By the way if you are developing code that will be distributed across mutltiple versions you should probably do it in the earliest version to avoid compatibility issues.
 

mab9

New Member
Joined
Apr 11, 2006
Messages
31
The offending code to XL2000 is

Code:
     ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
        True, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
        AllowFormattingRows:=True, AllowSorting:=True, AllowFiltering:=True

It protects a specific range from data changes/columns deletion but allows for formatting. This feature isn't available in 2000. I didn't realize until this morning that some people were still on old versions which is wy this hadn't come up.
 

Forum statistics

Threads
1,137,061
Messages
5,679,388
Members
419,825
Latest member
MegastarMagus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top