Max Wanadoo
max.wanadoo at gmail.com
Thu Mar 4 15:35:50 CST 2010
Hi All, I am struggling to get the SHELL command to run a batch file from Access. Any clues or tips? The batch file in turn will run and executable in the same folder as the currentproject.path BUT this exe file is NOT installed so it is necessary to ensure that I first move to that folder and then run the batch.bat file. Eg: g\_MyTest is my currentproject.path within Access In there I have blat.exe which is not installed and which I do not want to install - so nothing in the Registry. I also have blat.bat which I have created from Access. I want to run the batch file which in turn will invoke the blat.exe and pass it parameters. The batch file runs fine if manually invoked. This is the last bit of running Blat from within Access. I will then post the lot to the List. Thanks Max This is where I am at: Private Sub sShell(sFile) ' sfile will be "blat.bat" const conQuote as string = """" Dim sPath As String ' move into the current folder because we havn't installed Blat.exe sPath = conQuote & " CD /D " & CurrentProject.Path & conQuote Debug.Print sPath ShellExecute Application.hWndAccessApp, "Open", sPath, "", "", vbNormalFocus ' now run the batch file 'sFile = conQuote & sFile & conQuote Debug.Print sFile ShellExecute Application.hWndAccessApp, "Open", sFile, "", "", vbNormalFocus End Sub