Hi everyone,
I was wondering how i could refresh a userform every every 3 seconds or so?
I'm usingwithin the userform_activate module?application.ontime now + timevalue("00:00:03")
am i pi55in in the wind with that one?
Cheers
Mr MaGoo
Magoo.Inc MMVII
If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post
Hey Magoo, nice 1337.
I worry about your eyesight and a userform model or not model. It always happen to me that when a userform is showing, I can't do much else but work on it. If you do a refresh, is it because something on the sheet is changing? I don't think that can happen while the userform is displayed. I may be wrong with a modeless userform.
Look at the section in http://www.tushar-mehta.com/publish_...rinterface.htm titled A userform design model for forms shown modeless It may help answer your question.
Last edited by MarvinP; 01-25-2012 at 12:37 PM.
One test is worth a thousand opinions.
Click the * below to say thanks.
Hi Marv,
OK bit confused lol, Whats a 1337? also why the eyesight ref?
Anyway back to the point, I have created a mini "Chat app" in a userform that works by sending the messages to a access DB and also reading from the DB. I need to refresh the form every so often to update any new messages.
I have a refresh button that works fine but i would prefer not to have to refresh it manually.
any ideas?
not sure that link helped much buddy?
Cheers
Mr MaGoo
Magoo.Inc MMVII
If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post
Is your form modal or modeless?
Good luck.
answer: userform1.show 0
Mr MaGoo
Magoo.Inc MMVII
If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post
Bump?! any ideas folks?
Mr MaGoo
Magoo.Inc MMVII
If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post
You could use something akin to this
In a normal module
Userform code:Option Explicit Private Declare Function SetTimer Lib "user32" ( _ ByVal hwnd As Long, ByVal nIDEvent As Long, _ ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long Private Declare Function KillTimer Lib "user32" ( _ ByVal hwnd As Long, ByVal uIDEvent As Long) As Long Dim lRet As Long Private Const TimeoutSecond = 3 Sub loadform() UserForm1.Show False End Sub Public Function TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, _ ByVal idEvent As Long, ByVal dwTime As Long) As Long On Error Resume Next ' replace this with whatever code you like ' you may wish to put all the code as a public sub in the userform and call it from here UserForm1.Label1.Caption = Now End Function Sub StartTimer() lRet = SetTimer(0, 0, TimeoutSecond * 1000, AddressOf TimerProc) End Sub Sub StopTimer() On Error Resume Next KillTimer 0, lRet End Sub
Private Sub UserForm_Initialize() StartTimer End Sub Private Sub UserForm_Terminate() StopTimer End Sub
Good luck.
Why don't you use the double_click event or any other event to refresh the data ?
You didn't mention any periodicity in refreshing.
I don't want the user to have to refresh it that's why mate![]()
Mr MaGoo
Magoo.Inc MMVII
If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post
keep it simple
In the useform:
In the 'thisworkbook' modulePrivate Sub UserForm_Initialize() Thisworkbook.snb5 End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) Application.OnTime CDate(Tag), "Thisworkbook.snb5", , False End Sub
Replace 'MsgBox "cccc"' by your refreshing code, 'mate'.Sub snb5() MsgBox "cccc" UserForm1.Tag = DateAdd("s", 3, Now) Application.OnTime CDate(UserForm1.Tag), "thisworkbook.snb5" End Sub
Last edited by snb; 01-27-2012 at 02:35 AM.
Hi Mr. Magoo,
1. You wrote pi55ed-off which uses numbers for similar shaped letters. This is called LEET spelling or 1337 converted.OK bit confused lol, Whats a 1337? also why the eyesight ref?
2. Mr Magoo was one of my favorite cartoon, the blind old guy, along with Marvin the Martian.
I see that others have jumped into the answer. I'll read what they say in a minute after my very early morning coffee. (It's 5 am here!)
One test is worth a thousand opinions.
Click the * below to say thanks.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks