On file in XLSTART folder.

shajueasow

Well-known Member
Joined
Oct 7, 2004
Messages
1,926
Hi,
I have an excel file in XLSTART folder and it runs whenever Excel is launched. But can something be done so that it runs only once in a day. I use to launch excel 4-5 times a day and leaving the system running the whole day also is not a viable option.
TIA
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

texasalynn

Well-known Member
Joined
May 19, 2002
Messages
8,458
So maybe instead of XLStart you put the file into Windows startup

Then as you go thru the day and start a new excel session that file doesn't automatically open

HTH
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Following Texasalynn's suggestion even further, put in as a scheduled task so you could have it run at a specific time(s) of the day, not just on startup.
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

you could write the date to a cell on open
Code:
Option Explicit

Private Sub Workbook_Open()
Dim checkCell As Range
Set checkCell = Sheets(1).Cells(1, 1)

If Date - checkCell < 1 Then Exit Sub
checkCell = Date
'other code
End Sub
when opening the workbook again it will check for the "day-difference"
if not at least "1" then the code exits and does nothing more

kind regards,
Erik
 

shajueasow

Well-known Member
Joined
Oct 7, 2004
Messages
1,926
Thank You texasalynn and jonmo1 for your suggestions.
As I have stated I cannot keep the system running all the day....so even if the file is kept in Windows Startup folder, it will run each time windows is booted into.
And regarding using the scheduled task... it will run only at the time specified for it, and if the system is not running at that time...that also won't bring the desired result.
Thank you Erik for the code, that should settle the problem.
 

Watch MrExcel Video

Forum statistics

Threads
1,108,817
Messages
5,525,070
Members
409,617
Latest member
Lenaf

This Week's Hot Topics

Top