Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50070

Password & cell splash error when open workbook

$
0
0
Hi,
I have an error when I open workbook with password and make 1 cell splash. Is it possible for me to do that? Please look at the sample in the attached or code below:
Code:

Option Explicit
Private Sub Cancel_Click()
Unload Me
ActiveWorkbook.Close SaveChanges:=False
End Sub
Private Sub Enter_Click()
Dim pw As String
pw = "pws"
If TextBox1 <> "pws" Then
    MsgBox "Please Re-Enter password"
    TextBox1 = ""
    Exit Sub
Else
    Unload Me
End If

Range("H16").Value = "Welcome"

Dim FlashColor As Integer
Dim MakeFlash As Range
Dim x As Integer
Dim TheSpeed
Dim i

Set MakeFlash = Range("H16")
For Each i In MakeFlash
If i.Value = "Welcome" Then
FlashColor = 3 'Set the color to red
TheSpeed = 0.2
Do Until x = 10
DoEvents
'''''error from here'''
Start = Timer
Delay = Start + TheSpeed
Do Until Timer > Delay
DoEvents
MakeFlash.Interior.ColorIndex = FlashColor
Loop
Start = Timer
Delay = Start + TheSpeed
Do Until Timer > Delay
DoEvents
MakeFlash.Interior.ColorIndex = xlNone
Loop
x = x + 1
Loop

End If
Next i

End Sub
Private Sub UserForm_QueryClose _
  (Cancel As Integer, CloseMode As Integer)
    If CloseMode = vbFormControlMenu Then
    MsgBox "Sorry the X button does not work."
        Cancel = True
    End If
End Sub

Attached Files

Viewing all articles
Browse latest Browse all 50070

Trending Articles