Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ina ina is offline
external usenet poster
 
Posts: 120
Default schedule macro - application.OnTime

Hello guys,

I would like to schedule a macros

So first of all I would like to open an external program from excel
calling PLauch, once the program open I would like to execute my macro
"operations" and once the macro finished I would like to save it
somewhere. But I am not very convinient with Application.Ontime and
schedule macro.

This is my code


Public Sub Workbook_Open()
On Error GoTo ErrHand

Dim dtmTime As Date
Dim dtmSave As Date

OpenPLaunch ' I launch the program


dtmTime = Now + TimeValue("00:00:15")
Application.OnTime dtmTime, "operations"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"C:\test\test.xls", FileFormat:=xlHtml, ReadOnlyRecommended:=False,
CreateBackup:=False
'Application.DisplayAlerts = True
'dtmSave = dtmTime + TimeValue("00:01:00") 'I would like to have
the exact time after macro is finished
'Application.OnTime dtmSave, "Save_Exit"

ErrHand:
MsgBox "error"
End Sub

Sub operations()
Sheet1.Activate
Sheet1.GetInfo
Sheet2.Activate
Sheet2.AllClients

End Sub



Sub Save_Exit()
Application.Quit
ThisWorkbook.Close SaveChanges:=True
End Sub

Could someone help me with this issue?

Thanks ina

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default schedule macro - application.OnTime

See www.cpearson.com/excel/ontime.htm for details and example
code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"ina" wrote in message
oups.com...
Hello guys,

I would like to schedule a macros

So first of all I would like to open an external program from
excel
calling PLauch, once the program open I would like to execute
my macro
"operations" and once the macro finished I would like to save
it
somewhere. But I am not very convinient with Application.Ontime
and
schedule macro.

This is my code


Public Sub Workbook_Open()
On Error GoTo ErrHand

Dim dtmTime As Date
Dim dtmSave As Date

OpenPLaunch ' I launch the program


dtmTime = Now + TimeValue("00:00:15")
Application.OnTime dtmTime, "operations"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"C:\test\test.xls", FileFormat:=xlHtml,
ReadOnlyRecommended:=False,
CreateBackup:=False
'Application.DisplayAlerts = True
'dtmSave = dtmTime + TimeValue("00:01:00") 'I would like to
have
the exact time after macro is finished
'Application.OnTime dtmSave, "Save_Exit"

ErrHand:
MsgBox "error"
End Sub

Sub operations()
Sheet1.Activate
Sheet1.GetInfo
Sheet2.Activate
Sheet2.AllClients

End Sub



Sub Save_Exit()
Application.Quit
ThisWorkbook.Close SaveChanges:=True
End Sub

Could someone help me with this issue?

Thanks ina



  #3   Report Post  
Posted to microsoft.public.excel.programming
ina ina is offline
external usenet poster
 
Posts: 120
Default schedule macro - application.OnTime

Thank you


Ina

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
killing an OnTime schedule launched from a different workbook Antonio Excel Discussion (Misc queries) 2 June 9th 06 04:28 PM
Application OnTime...need some help to schedule. wayliff[_14_] Excel Programming 1 January 19th 06 07:47 PM
application.ontime rick Excel Programming 2 July 25th 05 06:09 PM
Application.OnTime -- Unable to Pass Macro with Numeric Parameter Butaambala Excel Programming 7 June 7th 05 10:55 PM
Application.OnTIme Mike Excel Programming 8 September 15th 04 03:27 PM


All times are GMT +1. The time now is 07:46 AM.

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"