I did not have much experience with VBA, but I sometimes use it at work. Recently, I have encountered a problem that should not happen, and that neither my boss nor I myself can understand.
Basically, the problem is that the Application DisplayAlerts property is set to True by default and cannot be changed for some reason. Perhaps this is due to the fact that when I got into an error, it always displays a warning about the end of work | Debug | Help and never accesses error handling applications.
I am running 64-bit Office 2010 on a 64-bit Windows 7 machine. However, I donβt think this is a platform problem since I tested several different platforms, operating systems and software permutations, and no other machine has this error; just mine.
I have created some code examples if someone came across this before or have any ideas. The only thing I can think of is that I have something installed on my machine that causes this. But after cleaning the program and many repeated starts, I am not going to decipher what may be.
Public Sub TestErrorHandler() ' Suppress alerts Application.DisplayAlerts = False Dim strArray(1) As String strArray(0) = "Hello" strArray(1) = "World" ' Set up error handler On Error GoTo ErrHandler For i = 0 To 3 MsgBox strArray(i) Next ' Strip the error handler On Error GoTo 0 ' Unsuppress alerts Application.DisplayAlerts = True Exit Sub ErrHandler: MsgBox "Error: " & Err.Description Resume Next End Sub
The error is called on the third for-loop enumeration (as it should be). The type of error does not matter, the important thing is that I get an error and never get into the error handler.
Any suggestions or help on this subject would be greatly appreciated.
Many thanks!
vba excel
Samuel slade
source share