# VBA Error 400



## Spoondigger (Dec 21, 2009)

I am using VBA for Excel. I keep getting error 400 pop up in a message box. Doesn't happen all of the time. I can't make it happen if its not happening. I can't stop it from happening once it happens. I seems almost arbitrary as to when it appears.

What is error 400?
What do I have to do to prevent error 400 from coming up?

Robert
NicholasBecea at hotmail dot com


----------



## macropod (Apr 11, 2008)

Hi Robert,

To track this down, you need to go into 'debug' mode when the error occurs at find out from the highlighted code line what the cause is. It's unlikely anyone will be able to help you unless you post a copy of the module, details of which line threw the error and what cells/forms/dialogue boxes were selected/active at the time.


----------



## Spoondigger (Dec 21, 2009)

Pressing the "Debug" button does not result in showing any code highlighted. Further, it is seriously unlikely that the any specific line of code is the problem, since the program can work for days without this error, and then the error just inadvertantly or randomly pops up. In fact, I can usually make it go away for days, simply by closing the error message and typing [CTRL][HOME].

Whatever is happening has to do with a combination of elements which involve not just the code, but some other catylist to set it off. The problem is that the error 400 has no description of what it is having a problem doing, and, in looking for a solution of all of the other people who have had an error 400 problem, their showing their code has only resulted in people giving alternative code which may or may not work, and certainly has nothing to do with my code.

What I need to know is: What is error 400 (it has nothing to do with Modal windows, as the documentation would suggest, since my code has nothing to do with Modal windows)?

If I know what is failing in the system, I can figure out a solution. As it stands now, I have no clue even where to look in my 2000 lines of code, or my 184gb hard drive, for what offends my spreadsheet at random intervals.

So, if someone knows what VBA error code 400 is, then please explain. If you need lines of my code to know the answer, then I can assure you that you are in the dark as much as am I.


----------



## Glaswegian (Sep 16, 2005)

I think a 400 error is pretty generic. What you could do is some error trapping, perhaps something like

```
On Error GoTo ErrorTrap
'your code here

'add this at the end of your code, before the End Sub

ErrorTrap:
MsgBox Err.Description
```
At least them you might find a description that would give you a clue as to the problem.


----------

