Time enabled Macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Is there anyway that you can activate a macro so it runs every 15 minutes, I have an written some code that takes an outlook body and places this in an excel workbook(test.xls) say a1,b1,c1,d1. I have then recorded a macro that then pulls that data through and pastes it as a row in my workbook(get_data) but I need to automate this process to run every 15 minutes. I hav einclude the code I have used belo

Sub get_data(

'copy the dat
ChDir "C:\
Workbooks.Open Filename:="C:\TEST.XLS
Range("A1:d1").Selec
Selection.Cop
'get the paste range for all of the dat
Windows("get_data.xls").Activat
Sheets("sheet1").Selec
Range("a2:d2").Selec
myPasteRows = Cells.CurrentRegion.Rows.Count +
'paste the dat
Range("a" & myPasteRows).Selec
Selection.PasteSpecial Paste:=xlValues, Transpose:=Tru
End Su

Thank

Ade
 
Ade,

You need the Ontime method.

Create an initiate macro, like

Sub StartJob()
Application.OnTime Now + TimeValue("00:15:00"), "get_Data"
End Sub

and then add the same command to the end of your 'get_Data()' macro to
re-set it for the next 15 mins.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Ade said:
Hi,

Is there anyway that you can activate a macro so it runs every 15 minutes,
I have an written some code that takes an outlook body and places this in an
excel workbook(test.xls) say a1,b1,c1,d1. I have then recorded a macro that
then pulls that data through and pastes it as a row in my workbook(get_data)
but I need to automate this process to run every 15 minutes. I hav einclude
the code I have used below
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top