Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
tried to execute application from VBA
Set filFile = fso.OpenTextFile(f & "\input.txt", 2, 1)
How does test_dll.exe know where to look for the file and what name to look for? Does it take an argument? If it looks in the default directory, does "f" put the file in the default directory. If it looks in the directory where it is located, does that match "f" So, does "f" in your code put the file in the right location. You should be looking for the file in "f" Regards, Tom Ogilvy "Domagoj Vulin" wrote in message ... I have Excel sheets and small Fortran application. I made a VBA macro that saves input data for Fortran exe into a .txt file. After that, I used Shell function in VBA macro tu execute FOR application and there is no error message, but there's neither a output TXT file that this FOR application usually creates. I looked in the folder where are all the files (Workbook, input TXT that macro created, Fortran EXE) and there is no output TXT file. Then, if I started that Fortran.exe from windows it creates the output file from that input file that I already created using the mentioned macro. I tried to find more about Shell function, but there is only a simple example that starts calc.exe from VBA macro. However, here is the critical part of code: ... Set filFile = fso.OpenTextFile(f & "\input.txt", 2, 1) filFile.WriteLine MP filFile.Close Set filFile = Nothing Set fso = Nothing MyRun = Shell(f & "\test_dll.exe", 1) Maybe the Shell function starts before the input.txt file is actually closed, i don't know... Thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
tried to execute application from VBA
test_dll.exe is, like all input and output files, and excel workbook in
folder that is "f". That exe application always searches for input.txt in the same dir where application runs. I was thinking this way: 1. before i tested test_dll.exe application - i wrote input data into input.txt file, I started test_dll.exe, and after that I got created output.txt file. 2. So now I can use Excel databases of input data and make macro that will create input.txt and that worked. Second step was only to execute test_dll.exe and this looks like it's working well, but it doesn't create output.txt. That's strange, because if wrong input data written test_dll.exe should show error message. 3. So, it doesn't work... well, I try manually start test_dll.exe, using the input.txt that Macro created and voila! Here is My Output.txt - but not from Excel. "Tom Ogilvy" wrote in message ... Set filFile = fso.OpenTextFile(f & "\input.txt", 2, 1) How does test_dll.exe know where to look for the file and what name to look for? Does it take an argument? If it looks in the default directory, does "f" put the file in the default directory. If it looks in the directory where it is located, does that match "f" So, does "f" in your code put the file in the right location. You should be looking for the file in "f" Regards, Tom Ogilvy "Domagoj Vulin" wrote in message ... I have Excel sheets and small Fortran application. I made a VBA macro that saves input data for Fortran exe into a .txt file. After that, I used Shell function in VBA macro tu execute FOR application and there is no error message, but there's neither a output TXT file that this FOR application usually creates. I looked in the folder where are all the files (Workbook, input TXT that macro created, Fortran EXE) and there is no output TXT file. Then, if I started that Fortran.exe from windows it creates the output file from that input file that I already created using the mentioned macro. I tried to find more about Shell function, but there is only a simple example that starts calc.exe from VBA macro. However, here is the critical part of code: ... Set filFile = fso.OpenTextFile(f & "\input.txt", 2, 1) filFile.WriteLine MP filFile.Close Set filFile = Nothing Set fso = Nothing MyRun = Shell(f & "\test_dll.exe", 1) Maybe the Shell function starts before the input.txt file is actually closed, i don't know... Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Button to execute Add-in | Excel Discussion (Misc queries) | |||
Execute a sub in a different project | Excel Discussion (Misc queries) | |||
concatenate and then execute? | Excel Worksheet Functions | |||
Execute C++ from Excel | New Users to Excel | |||
Could not execute | Excel Worksheet Functions |