Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel -- stop execution of workbook_open ?

Status
Not open for further replies.

wotgoesup

IS-IT--Management
Oct 25, 2002
39
US
I have timesheets with a Workbook_Open macro that asks if it's a new week. If it is, it adds 7 days to a cell and uses that as part of the file name for the save. Works fine, each member of the team has their own wkbk, and the date is the same in each.
I copy those 3 into one workbook with a summary sheet. This has the same date cell, and the VBA builds the file name and opens the required workbook for the team members, but when it tries to copy into the summary workbook, the open macro for each time sheet gets executed.

i.e. the summary VBA triggers the "new week?" msgbox in each timesheet it opens.
How do I stop / bypass the msgbox when executing the summary VBA?

summary has Workbooks.Open filename:= .
which opens each timesheet,
they have

"Private Sub Workbook_Open()"


a = MsgBox("Start a New Week?", vbYesNo)
If a = vbYes Then
...

ActiveWorkbook.SaveAs filename:= _
("G:\time\" & efiletxt)
End If
[hairpull]
THANKS!
 
Why not use a linked workbook?

I don't know if it's practical; just a thought.



Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Ron -
Thanks for the idea, but there's another condition:
The manager may not want the updated timesheets - he may want what was there last time he opened it. So I have a msgbox that asks if you want to update the sheets.
If I link, I think it will update every time it's opened.
[ponder]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top