Re: Weird PropertyBag problem, values won't change

Tech-Archive recommends: Speed Up your PC by fixing your registry



Okay, here's a COMPLETE program to replicate the problem:

-----------------------------------------------------------------
Option Explicit

Public pBag As New PropertyBag

Public Sub Main()
Dim i As Integer
Dim nTime As Long
pBag.WriteProperty "Timeout", DateAdd("s", 30, Now)
Debug.Print "Timeout = " & pBag.ReadProperty("Timeout")
nTime = Timer
Do While Timer < nTime + 5
DoEvents
Loop
UpdateTimeout
nTime = Timer
Do While Timer < nTime + 5
DoEvents
Loop
Debug.Print "Timeout = " & pBag.ReadProperty("Timeout")
nTime = Timer
Do While Timer < nTime + 5
DoEvents
Loop
pBag.WriteProperty "Timeout", DateAdd("s", 30, Now)
Debug.Print "Timeout = " & pBag.ReadProperty("Timeout")
End Sub

Public Sub UpdateTimeout()
pBag.WriteProperty "Timeout", DateAdd("s", 30, Now)
Debug.Print "Updated timeout = " & pBag.ReadProperty("Timeout")
End Sub
----------------------------------------------------------------

Look VERY CLOSELY at the output in the debug window...

Any ideas?

.



Relevant Pages

  • RE: switching window stops running macros
    ... Public nTime As Double ... Public Sub StartTimer() ... Application.OnTime nTime, "RunTimer",, False ... switch to window 2, the timer in the window 1 stops!! ...
    (microsoft.public.excel.programming)
  • RE: switching window stops running macros
    ... Public nTime As Double ... Public Sub StartTimer() ... Application.OnTime nTime, "RunTimer",, False ... switch to window 2, the timer in the window 1 stops!! ...
    (microsoft.public.excel.programming)
  • switching window stops running macros
    ... switch to window 2, the timer in the window 1 stops!! ... Public nTime As Double ... Public Sub StartTimer() ... Application.OnTime nTime, "RunTimer",, False ...
    (microsoft.public.excel.programming)
  • Re: Time consumption in macros
    ... rough and ready but should suit ... Dim nTime As Double ... MsgBox Timer - nTime ...
    (microsoft.public.excel.programming)