Need Excel Workbook to open at Windows Startup

T

Tom K.

My company uses a macro-driven Excel workbook as a timesheet. With Windows
98, the workbook could be stored in the Windows Startup folder to have it
automatically displayed when the computer was started. With Windows 2000 and
XP, the worksheet no longer will display. Sometimes Excel will launch but
not display the workbook and other times the program does not.

Any suggestions on how an Excel Timesheet workbook can be automatically
launched when Windows is started?

Thanks!
 
D

Dave

try making a scheduled task for it and have it run either 'when my computer
starts' if you don't force user login, or 'when i log on' if you do.
 
D

Dude

the other way is to create a "service" and have it run as soon as windows
starts.
See the Services icon in your Windows Control Panel or System Tools folder
 
K

Karl E. Peterson

Tom said:
Any suggestions on how an Excel Timesheet workbook can be
automatically launched when Windows is started?

Add a run key to the registry at
[HKCU|HKLM]\Software\Microsoft\Windows\CurrentVersion\Run. Just follow the same
syntax as you see there, to add whatever command line is necessary for Excel to open
the required workbook.

If you'd like to do this programatically, see http://vb.mvps.org/samples/RunOnce, or,
short-story:

Public Function RunNextBoot( _
ByVal AppName As String, ByVal CmdLine As String, _
Optional ThisUserOnly As Boolean = False, _
Optional RunEveryBoot As Boolean = False) As Boolean

Dim SubKey As String
Dim TopKey As Long
Dim nRet As Long
Dim hKey As Long
Dim nResult As Long

' Assign subkey string appropriately.
If RunEveryBoot Then
SubKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
Else
SubKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
End If

' Select appropriate top-level key.
If ThisUserOnly Then
TopKey = HKEY_CURRENT_USER
Else
TopKey = HKEY_LOCAL_MACHINE
End If

' Open (or create and open) key
nRet = RegCreateKeyEx(TopKey, SubKey, 0&, vbNullString, _
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, ByVal 0&, _
hKey, nResult)
If nRet = ERROR_SUCCESS Then
' Write new value to registry
nRet = RegSetValueEx(hKey, AppName, 0&, REG_SZ, _
ByVal CmdLine, Len(CmdLine))
Call RegCloseKey(hKey)
End If
RunNextBoot = (nRet = ERROR_SUCCESS)
End Function

Later... Karl
 

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