ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Delay to startup excel spreadsheet (https://www.excelbanter.com/excel-worksheet-functions/38197-delay-startup-excel-spreadsheet.html)

Gee

Delay to startup excel spreadsheet
 
Hi all,

I have an excel spreadsheet that starts up from the start-up folder. The
problem is that it starts up before another program does that imports DDE
data into the spreadsheet. This would then cause the spreadsheet to hang. Is
it possible to place a delay statement in the start-up line that would delay
the excel spreadsheet for 5 or 10 seconds.

Thanks for the help.



Bernie Deitrick

Gee,

You could move that file to another folder, and then use the workbook open event of another workbook
to schedule a macro that will open your workbook that needs to wait. For example, if your workbook
is named "Needs Delay.xls", and is in the folder C:\Excel, put this into the codemodule of the
ThiswWorkbook object of a file that is in your start-up folder:

Private Sub Workbook_Open()
Application.OnTime Now() + TimeValue("00:00:15"), "OpenItLater"
End Sub

And put this into a regular codemodule in that same book:

Sub OpenItLater()
Workbooks.Open "C:\Excel\Needs Delay.xls"
End Sub

Then the file "C:\Excel\Needs Delay.xls" will be opened 15 seconds after the other file is opened.

HTH,
Bernie
MS Excel MVP


"Gee" wrote in message ...
Hi all,

I have an excel spreadsheet that starts up from the start-up folder. The
problem is that it starts up before another program does that imports DDE
data into the spreadsheet. This would then cause the spreadsheet to hang. Is
it possible to place a delay statement in the start-up line that would delay
the excel spreadsheet for 5 or 10 seconds.

Thanks for the help.





Harlan Grove

Gee wrote...
I have an excel spreadsheet that starts up from the start-up folder. The
problem is that it starts up before another program does that imports DDE
data into the spreadsheet. This would then cause the spreadsheet to hang. Is
it possible to place a delay statement in the start-up line that would delay
the excel spreadsheet for 5 or 10 seconds.


While this may involve 2 separate processes as far as Windows is
concerned (the DDE client and Excel), this is a single 'logical'
process involving 2 sequential steps. The most reliable way to deal
with this is to use a single entry in your Startup folder to run both
programs in sequence with a delay between them. That's most easily done
using a batch file.

Adding delays to batch files is more difficult than it should be.
Windows 95/98/Me come with a program named CHOICE.EXE which could be
used to provide a delay, but this particular program is part of the
Resource Kit for Windows NT4/2000/XP, so a $$ add-on. However, Windows
NT4/2000/XP comes with Windows Script Host, and it can be used to
create timed pauses in batch files. If you have a file named, say,
donothing.vbs which contains the plain text


'donothing.vbs
Do 'Forever
'nothing
Loop


you could use the following batch file to run your DDE client, pause
for 15 seconds, then run Excel with your specific workbook.


@REM SampleBatchFile.BAT
@echo off
start <YourDDEClientPathnameHere <AnyArgumentsHere
cscript <PathAsNeededdonothing.vbs //T:15 //B
start <YourParticularExcelWorkbookPathnameHere


Replace the shortcuts to your DDE client and your Excel workbook in
your Startup folder with a shortcut to this batch file.



All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com