Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-28-2012, 12:04 PM
yabbah yabbah is offline Run a macro each minute? Windows XP Run a macro each minute? Office 2007
Novice
Run a macro each minute?
 
Join Date: Mar 2012
Posts: 8
yabbah is on a distinguished road
Default Run a macro each minute?

Hi out there, Im kinda new on excel.



I made a page that query data from an external xlm, and it works great. Except that I need to update it manual, I record a macro that update it.
But how can I schedule this macro to be run each minute?

//yabbah
Reply With Quote
  #2  
Old 05-29-2012, 12:15 AM
yabbah yabbah is offline Run a macro each minute? Windows XP Run a macro each minute? Office 2007
Novice
Run a macro each minute?
 
Join Date: Mar 2012
Posts: 8
yabbah is on a distinguished road
Default

It cant be true that none know how to execute a macro each minute?
Reply With Quote
  #3  
Old 05-29-2012, 12:29 AM
krishnaoptif krishnaoptif is offline Run a macro each minute? Windows XP Run a macro each minute? Office 2007
Novice
 
Join Date: May 2012
Posts: 23
krishnaoptif is on a distinguished road
Default

Hi,
Please use below code and call your macro in this...
Quote:
Option Explicit
Sub AutoRunAfter1Minute()

Dim i As Long
'i is minute...

For i = 1 To 5000

'Call your Macro or Your Code
MsgBox "Your Macro"



Application.Wait (Now + TimeValue("0:01:00"))

Next i

End Sub
Reply With Quote
  #4  
Old 05-29-2012, 02:06 AM
yabbah yabbah is offline Run a macro each minute? Windows XP Run a macro each minute? Office 2007
Novice
Run a macro each minute?
 
Join Date: Mar 2012
Posts: 8
yabbah is on a distinguished road
Default

But that code gived a dialogbox that I need to press OK on, thats not a solution. This will be on a screen just like a viewer, so I would like to have it automatic.

I use xml-dataimport, and the "refresh every XX minutes" and all other options in the connection-settings is grayed out. So I cant use excels inbuilt feature for auto-update.

As intelligent excel is, and how much there can be done in it, it would supprice me much if it cant be done.
Reply With Quote
  #5  
Old 05-29-2012, 02:18 AM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Run a macro each minute? Windows 7 32bit Run a macro each minute? Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

Hi,

The intention of Krishna's reply was to outline one potential approach and that you adapt it to suit your needs. Where Krishna's code shows a message box you should change that to call your macro instead.

That aside, I think you should look into using Timers. Have a look at the Application.OnTime method in your VBA helpfile. For further information and examples you can read this excellent article by Chip Pearson:
http://www.cpearson.com/excel/OnTime.aspx

For now I recommend that you avoid using the Windows Timers: unless they are used with due caution and care they may cause Excel to crash under certain circumstances.

Good luck!
__________________
Colin

RAD Excel Blog
Reply With Quote
  #6  
Old 05-31-2012, 01:01 AM
yabbah yabbah is offline Run a macro each minute? Windows XP Run a macro each minute? Office 2007
Novice
Run a macro each minute?
 
Join Date: Mar 2012
Posts: 8
yabbah is on a distinguished road
Default

I solved it using this line in the vba,
Application.OnTime Now + TimeValue("00:00:10"), "nameOfMyMacro"

Thanks all for your help.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Run a macro each minute? How to write the degree, minute second format in excel Jamal NUMAN Excel 12 07-09-2018 11:44 PM
How do I assign a macro to a button when the macro is in my personal workbook? foolios Excel Programming 2 07-27-2011 02:41 PM
Run a macro each minute? Upgraded from Outlook 2003 to 2010, after a minute, Outlook closes on its own Ckingfly Outlook 3 06-12-2011 07:43 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:05 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft