|
|
| CreateProcessA problem - no DOS windows appearing |
|
| Author |
Message |
skt1974

|
Posted: Visual Basic for Applications (VBA), CreateProcessA problem - no DOS windows appearing |
Top |
Hi
I have an Excel model which (once a lot of data is entered) saves some data as a text file and uploads it to an OLAP database. It does this using CreateProcessA to run a command line. (Code at the bottom of this message.) The code wasn't written by me, but comments on the code say it was from the MS web site.
This has worked fine in the past, but I have recently upgrated from Windows 2000 to XP (and from Office 2000 to 2003) and it no longer works. The CreateProcessA command fails to open a DOS window.
I thought it was an XP problem, but a colleage has the same set up as me and the upload works fine on his PC.
So I think the code's OK, but it seems there's something on my PC that's interfering with it. Any ideas where I can start to look for the problem
Cheers skt1974
Here's the code: Public Function ExecCmd(cmdLine)
' Run external process & wait for completion Dim proc As PROCESS_INFORMATION Dim start As STARTUPINFO
' Initialize the STARTUPINFO structure: start.cb = Len(start)
' Start the shelled application: ret& = CreateProcessA(vbNullString, cmdLine, 0&, 0&, 1&, _ NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Wait for the shelled application to finish: ret& = WaitForSingleObject(proc.hProcess, INFINITE) Call GetExitCodeProcess(proc.hProcess, ret&) Call CloseHandle(proc.hThread) Call CloseHandle(proc.hProcess) ExecCmd = ret&
' End of MS web site code
End Function
Microsoft ISV Community Center Forums3
|
| |
|
| |
 |
FuturePub

|
Posted: Visual Basic for Applications (VBA), CreateProcessA problem - no DOS windows appearing |
Top |
Hi skt1974,
Unfortunately I'm experiencing *exactly* the same problem - I upgraded from Windows 2k to XP, and Excel from 2000 to 2003, and my CreateProcessA command is no longer working.
(Incidentally im running the exact same piece of code to get my data saved as a text file into an OLAP database). Spooky :)
If you have found a solution to this problem it would be much appreciated - if I find one myself I will let you know.
Thanks,
FP
|
| |
|
| |
 |
skt1974

|
Posted: Visual Basic for Applications (VBA), CreateProcessA problem - no DOS windows appearing |
Top |
Hi FP
I've just remembered I'd not updated my post when I found the solution, and felt bad, but at least now hopefully my solution will help you so my post wasn't just a waste of time.
Embarrassingly, my problem was down to user error. When I'd installed Essbase on my PC after the upgrade I didn't select the options I needed (API etc) I just pressed Default, so the dos commands I needed weren't installed.
Therefore, the CreateProcessA command not waorking was a result of the command line not being executable. Maybe this is your problem too. Try running some of your commands in a DOS window and see if you get any error messages.
Good luck! skt1974
|
| |
|
| |
 |
| |
|