Windows XP Workbook open does not launch

Joined
Oct 30, 2008
Messages
4
Reaction score
0
Is there code that will run an autoexec type of code that will check the day of the week of the current date and if it = Friday, then create a copy of a specific WkSheet within a Workbook and paste and rename it in another workbook.

I have the code down that will create the back up however, I am unsure on how to schedule the task to run every Friday.

I found the attached code that will work correctly when asked to execute, however, it does not launch when the user opens the Workbook, WHY?

Any suggestions?

Karen

Here is what I have so far:
Public Sub Workbook_Open()
If VbDayOfWeek(Date) = 5 Then ' = DatePart(d, Date, vbThursday) Then
Call mcrArchiveStageStatus
Else
Exit Sub
End If
End Sub


Sub mcrArchiveStageStatus()
'
' mcrArchiveStageStatus Macro
' Macro recorded 10/29/2008 by Karen Schaefer
Workbooks.Open Filename:="C:\Development\LEDR\StageStaus_Archive.xls"
Windows("Metrics_IPT_747-8.xls").Activate
Sheets("By Stage Status").Select
Sheets("By Stage Status").Copy Before:=Workbooks("StageStaus_Archive.xls"). _
Sheets(1)
Sheets("By Stage Status").Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("By Stage Status").Select
Sheets("By Stage Status").Select
Sheets("By Stage Status").Name = Format(Date, "mmm dd yy")
Windows("StageStaus_Archive.xls").Activate
ActiveWorkbook.Save
ActiveWorkbook.Close

End Sub
 

Silverhazesurfer

Master of Logic
Joined
Oct 3, 2008
Messages
1,068
Reaction score
42
as dumb as it sounds, use task scheduler.........if you have a prog that works doing what you want, simply put it on a schedule with windows to run at a certain day and time.

start>accessories> system tools> scheduled tasks

- Surfer
 
Joined
Oct 30, 2008
Messages
4
Reaction score
0
Thanks for the suggestion, however, I had plan on using the Task Scheduler, however the WorkBook_Open still will not launch when I open the original xls. It only executes if I tell it to.

What am I missing?

K
 
Joined
Oct 30, 2008
Messages
4
Reaction score
0
I am also trying to create a 3rd xls - to launch the code instead of on open of the original xls, because I do not want the code to run every time it is opened - only on a schedule time in the evening. Also, would this run on server?
 

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

Top