Wrox Programmer Forums
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 24th, 2006, 09:19 AM
Authorized User
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default Timed Executable

I have an excel file which contains Macros which I would like to run every day before I get to work. Since my company makes us shut down our computers, I would like to place an executable on one of the servers to Fire my Macros @ 7:00A.M everyday.

Does anyone have any code to do this?

To fire at 7:00 am,
1)Open Test.xls -on my- "Y:\Cost\Wally\Past Daily Runs\Test.xls
2)Execute macro 'Sub Test'
3)Shut down.

Thank you

Appreciate your help
Old July 28th, 2006, 10:55 AM
Authorized User
Join Date: Jul 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts

Add Microsoft Excel 9.0 Object Library as a reference

Put this in your general declarations

Dim oExcel As New Excel.Application
Put this in your Form's initialize event

oExcel.Visible = False
oExcel.DisplayAlerts = False
oExcel.Workbooks.Open ("Y:\Cost\Wally\Past Daily Runs\Test.xls")
Add a Timer control to your form. Change the interval property from 0 to 1.

In the timer event of the Timer control, put the following code

If Time = "7:00:00 AM" Then
  oExcel.Run "Sub Test"
End If
This worked for me using VB6 and Excel 2000

Similar Threads
Thread Thread Starter Forum Replies Last Post
Timed alerts. jpool Visual Basic 2005 Basics 4 June 28th, 2008 09:26 AM
TIMED response.redirect misskaos Classic ASP Basics 2 December 9th, 2006 08:13 PM
Tool Has Timed Out m_gorbani ASP.NET 2.0 Professional 1 March 14th, 2006 07:07 AM
Automatic Timed Event echovue Access 4 September 27th, 2005 12:01 PM
What if Session Timed Out?? MAtkins General .NET 2 January 23rd, 2005 12:26 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.