Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Fire a macro

Any idea how to have fetch file automatically fetch the data at say; 7:30 AM
every weekday? Right now I have to push a button but may not always be here
throughout the day to do it and I would hate to miss a days worth of data or
more if I happen to be on vacation.
I normally press a button in cell A1 of the sheet to activate this macro.
--
Thank you!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Fire a macro

Doug,

You could do that with application.ontime privideing the workbook was open
of course.

This bit of code to get things started
Private Sub Workbook_Open()
Application.OnTime TimeValue("07:30:00"), "YourMacro"
End Sub

then this in a 'general Module' to make it continue to work every weekday at
07:30

Sub YourMacro()
Application.OnTime
TimeValue ("07:30:00"), "MyMacro"
If Weekday(Now, 2) 5 Then Exit Sub
'YOUR CODE
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Doug" wrote:

Any idea how to have fetch file automatically fetch the data at say; 7:30 AM
every weekday? Right now I have to push a button but may not always be here
throughout the day to do it and I would hate to miss a days worth of data or
more if I happen to be on vacation.
I normally press a button in cell A1 of the sheet to activate this macro.
--
Thank you!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Fire a macro

Is there a way to do it with the workbook closed? I would rather not even
open the workbook unless I find that there is something wrong with the data
that I pull from it in another workbook.
--
Thank you!


"Mike H" wrote:

Doug,

You could do that with application.ontime privideing the workbook was open
of course.

This bit of code to get things started
Private Sub Workbook_Open()
Application.OnTime TimeValue("07:30:00"), "YourMacro"
End Sub

then this in a 'general Module' to make it continue to work every weekday at
07:30

Sub YourMacro()
Application.OnTime
TimeValue ("07:30:00"), "MyMacro"
If Weekday(Now, 2) 5 Then Exit Sub
'YOUR CODE
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Doug" wrote:

Any idea how to have fetch file automatically fetch the data at say; 7:30 AM
every weekday? Right now I have to push a button but may not always be here
throughout the day to do it and I would hate to miss a days worth of data or
more if I happen to be on vacation.
I normally press a button in cell A1 of the sheet to activate this macro.
--
Thank you!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Fire a macro

Use Task Scheduler to start Excel and open the workbook every day at a
designated time.

You will have workbook_open code which fetches the data then saves and
closes the workbook then shuts down Excel.

Like 4:30AM when no one will be around and using Excel.


Gord Dibben MS Excel MVP


On Mon, 24 May 2010 11:18:04 -0700, Doug
wrote:

Is there a way to do it with the workbook closed? I would rather not even
open the workbook unless I find that there is something wrong with the data
that I pull from it in another workbook.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Fire a macro

Once I set it like this, how can I stop the macro if I need to look at the
workbook?
--
Thank you!


"Gord Dibben" wrote:

Use Task Scheduler to start Excel and open the workbook every day at a
designated time.

You will have workbook_open code which fetches the data then saves and
closes the workbook then shuts down Excel.

Like 4:30AM when no one will be around and using Excel.


Gord Dibben MS Excel MVP


On Mon, 24 May 2010 11:18:04 -0700, Doug
wrote:

Is there a way to do it with the workbook closed? I would rather not even
open the workbook unless I find that there is something wrong with the data
that I pull from it in another workbook.


.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Fire a macro

This code doesn't close the workbook after it runs the application. Do you
know what I should have in there instead?

Application.Run "KingWebFetchSAS.xls!GetDataSAS"
ActiveWorkbook.RunAutoMacros Which:=xlAutoClose
--
Thank you!


"Gord Dibben" wrote:

Use Task Scheduler to start Excel and open the workbook every day at a
designated time.

You will have workbook_open code which fetches the data then saves and
closes the workbook then shuts down Excel.

Like 4:30AM when no one will be around and using Excel.


Gord Dibben MS Excel MVP


On Mon, 24 May 2010 11:18:04 -0700, Doug
wrote:

Is there a way to do it with the workbook closed? I would rather not even
open the workbook unless I find that there is something wrong with the data
that I pull from it in another workbook.


.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Fire a macro

Thank you!
This code doesn't close the workbook after it runs the application. Do you
know what I should have in written instead to close the workbook?
Application.Run "KingWebFetchSAS.xls!GetDataSAS"
ActiveWorkbook.RunAutoMacros Which:=xlAutoClose


--
Thank you!


"Mike H" wrote:

Doug,

You could do that with application.ontime privideing the workbook was open
of course.

This bit of code to get things started
Private Sub Workbook_Open()
Application.OnTime TimeValue("07:30:00"), "YourMacro"
End Sub

then this in a 'general Module' to make it continue to work every weekday at
07:30

Sub YourMacro()
Application.OnTime
TimeValue ("07:30:00"), "MyMacro"
If Weekday(Now, 2) 5 Then Exit Sub
'YOUR CODE
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Doug" wrote:

Any idea how to have fetch file automatically fetch the data at say; 7:30 AM
every weekday? Right now I have to push a button but may not always be here
throughout the day to do it and I would hate to miss a days worth of data or
more if I happen to be on vacation.
I normally press a button in cell A1 of the sheet to activate this macro.
--
Thank you!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
.OnEntry Macro does not fire when pasting David Excel Programming 1 May 6th 08 03:55 PM
ListBox Selection to fire Macro Kaye Excel Programming 7 March 13th 07 04:56 PM
Fire Macro from Cell Change Slashman Excel Worksheet Functions 7 October 17th 06 04:08 AM
fire macro on AutoFilter change jeffP Excel Programming 2 September 14th 04 01:12 AM
how to get onkey macro to fire while another macro is running Brian Murphy Excel Programming 8 August 25th 04 05:38 AM


All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"