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.
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.