Results 1 to 3 of 3

Thread: Solved: Sleep - Problem

  1. #1
    VBAX Regular
    Joined
    Jan 2009
    Posts
    57
    Location

    Solved: Sleep - Problem

    I have followed the advice on the Article pages to 'Create a Delay' using:

    [VBA]Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    at the top of a module with this code:

    Sub DelayTest()
    Menu.lblSaved.Visible = True
    Sleep 1000& 'delay in milliseconds
    Menu.lblSaved.Visible = False
    End Sub[/VBA]

    I'm trying to get a label with caption "Saved" to show for a short time on clicking a Save button on my form. However, when I call 'DelayTest' nothing happens apart from the time delay.
    If I run through the code step by step the label does show, the time delay does work, and then the label does disappear again.

    I'm baffled if anyone can shed light please.

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,970
    try the repaint method
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Regular
    Joined
    Jan 2009
    Posts
    57
    Location
    I've never even heard of the Repaint method. But hey presto it works like a dream. Don't know what the problem was before but this certainly fixes it.

    Thanks p45cal

Posting Permissions

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