shell function - specify startup directory

ericgeil

Registered User.
Local time
Today, 11:54
Joined
Jun 6, 2000
Messages
14
How can you run a program using "shell" and specify a "Start In" directory. For example, I have a win 98 shortcut that has the following info:

Target : C:\KRONOS\APPS\tkcwin.exe
Start In: x:\KRONOS\data

witout the "start in" info, the program will not run

I have tried shell "C:\KRONOS\APPS\tkcwin.exe" "x:\KRONOS\data"

didn't work

Thank you

Eric
 
I haven't tried this myself, but have you tried using the SHORTCUT as the file the shell command is trying to open? Then the information will be there.

So, in other words try setting the path to your desktop shortcut (or explorer shortcut) and see if that works.

BL
hth
 
Try the following.

Function HelpForYou()

'Declare the Variables
Dim sX, sLessonName As String, sLessonPath As String
Dim sCompleteFileName As String, sOptions As String
Dim db As DAO.Database, rec As DAO.Recordset
Set db = CurrentDb()

'Here I just set my recordset...
Set rec = db.OpenRecordset("SELECT tl_ReportGen.Report_Name, tl_ReportGen.Text_Name FROM tl_ReportGen WHERE (((tl_ReportGen.Text_Name)='" & Forms![frmOneWindow]![sfrm1].Form![cmbLesson] & "'));")

sLessonName = rec![Report_Name]
'In my application, I have the user select which lesson (or in your case file)
'he/she wants to run in a simple Dropdown Box.

sLessonPath = Forms![frmOneWindow]![sfrm1].Form![sfrmLessonLocator].Form![txtLessonLocator]
sOptions = " /S /C"
sCompleteFileName = "" & sLessonPath & sLessonName & sOptions & ""

sX = Shell("" & sCompleteFileName & "", 1)

End Function
 

Users who are viewing this thread

Back
Top Bottom