+ Reply to Thread
Results 1 to 3 of 3

Password & cell splash error when open workbook

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Password & cell splash error when open workbook

    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:
    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 Attached Files
    Last edited by tuongtu3; 11-11-2012 at 12:40 PM. Reason: Solved

  2. #2
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Password & cell splash error when open workbook

    Hi,

    Since you used Option explicit, you have define Start and delay.
    Use Dim Start, Dim Delay
    Also I noticed that the code in attachment contains 'starts' instead of 'start'

  3. #3
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Password & cell splash error when open workbook

    Quote Originally Posted by haripopuri View Post
    Hi,

    Since you used Option explicit, you have define Start and delay.
    Use Dim Start, Dim Delay
    Also I noticed that the code in attachment contains 'starts' instead of 'start'
    Hi haripopuri,
    Thank you very much for your help.

    Regards,
    tt3

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1