Share via

ms excel userform application ontime

Anonymous
2013-03-13T17:43:25+00:00

Is there anyway to use an application on time event on an excel userform? I have a load picture event on userform activate and I would like for it to rerun that same activation code or call out a macro to reload the pictures every 30 seconds. My activate code is as follows.

Private Sub UserForm_Activate()

Me.Image1.Picture = LoadPicture("S:\Shops\Test Track - Eng\Weather data\10MinAvgWindSpeed.gif")

Me.Image2.Picture = LoadPicture("S:\Shops\Test Track - Eng\Weather data\Barometer.gif")

Me.Image3.Picture = LoadPicture("S:\Shops\Test Track - Eng\Weather data\OutsideTemp.gif")

Me.Image4.Picture = LoadPicture("S:\Shops\Test Track - Eng\Weather data\WindDirection.gif")

Me.Image5.Picture = LoadPicture("S:\Shops\Test Track - Eng\Weather data\WindSpeed.gif")

End Sub

Thanks in advance,

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Andreas Killer 144.1K Reputation points Volunteer Moderator
2013-03-14T08:19:24+00:00

Copy that sub in a regular module

Rename it as ReloadPictures, and make it public

Replace "Me" with the name of your userform (e.g "Userform1")

Add the line

  On Error Goto ExitPoint

at the top and

  Application.OnTime Now+TimeSerial(0,0,30), "ReloadPictures"

  ExitPoint:

at the bottom. Use this sub in your form

Private Sub UserForm_Activate()

  ReloadPictures

End Sub

Andreas.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2013-03-14T10:19:14+00:00

    Perfect, Thanks Andreas

    Was this answer helpful?

    0 comments No comments