PDA

View Full Version : error -2147024894 (80070002)



basboy1991
10-18-2013, 10:50 AM
hi guys,

i'm totaly a newbie with vba in excel. Right now i have created a msg box with the option to hide a message. the code is

Private Sub Worksheet_Activate()

Dim hidemessage As Boolean, p As Variant
If ThisWorkbook.CustomDocumentProperties.Count > 0 Then
For Each p In ThisWorkbook.CustomDocumentProperties
If p.Name = "hidemessage" Then hidemessage = False

Next
End If
If Not hidemessage Then
If MsgBox("hoi papa en" & ActiveSheet.Name & vbNewLine & "Click no to not show this message again", vbYesNo) = vbNo Then
ThisWorkbook.CustomDocumentProperties.Add "hidemessage", False, msoPropertyTypeBoolean, True
End If
End If


Worksheets(" Bas").Range("e8").Clear




End Sub




when i press yes the script is running correctly but when i press no i get the error -2147024894 (80070002) automation error. how to resolve this problem.

SamT
10-19-2013, 07:04 AM
I could not duplicate the error using Excel 2002, SP3, in Windows XP.
I commented out the line
Worksheets(" Bas").Range("e8").Clear
Try doing the same.