![]() |
Call other application from excel
Hi,
I am using Shell ("c:\Program Files\X\X.EXE") to run another program from excel , now how can I make this code to open a specific file for me actually in this case both excel and X application are using the same file name but the extensions are like 04094.xls and 04094.XXX . Thanks in advance. Afshin |
Call other application from excel
Not sure I fully understand what you are trying to achieve. maybe this will
help you: fileOpen = Shell("notepad.exe " & fileName, vbMaximizedFocus) or if you want to use an office application you may look at this (Activating Other Applications with Excel VBA section): http://www.geocities.com/jonpeltier/Excel/XL_PPT.html regards, KL "A-Design" wrote in message ... Hi, I am using Shell ("c:\Program Files\X\X.EXE") to run another program from excel , now how can I make this code to open a specific file for me actually in this case both excel and X application are using the same file name but the extensions are like 04094.xls and 04094.XXX . Thanks in advance. Afshin |
Call other application from excel
If I understand correctly you are asking about this:
fileOpen = Shell("c:\Program Files\X\X.EXE " & "c:\myfolder\04094.XXX", vbMaximizedFocus) KL "KL" wrote in message ... Not sure I fully understand what you are trying to achieve. maybe this will help you: fileOpen = Shell("notepad.exe " & fileName, vbMaximizedFocus) or if you want to use an office application you may look at this (Activating Other Applications with Excel VBA section): http://www.geocities.com/jonpeltier/Excel/XL_PPT.html regards, KL "A-Design" wrote in message ... Hi, I am using Shell ("c:\Program Files\X\X.EXE") to run another program from excel , now how can I make this code to open a specific file for me actually in this case both excel and X application are using the same file name but the extensions are like 04094.xls and 04094.XXX . Thanks in advance. Afshin |
Call other application from excel
That is it,
Thank you KL, "KL" wrote in message ... If I understand correctly you are asking about this: fileOpen = Shell("c:\Program Files\X\X.EXE " & "c:\myfolder\04094.XXX", vbMaximizedFocus) KL "KL" wrote in message ... Not sure I fully understand what you are trying to achieve. maybe this will help you: fileOpen = Shell("notepad.exe " & fileName, vbMaximizedFocus) or if you want to use an office application you may look at this (Activating Other Applications with Excel VBA section): http://www.geocities.com/jonpeltier/Excel/XL_PPT.html regards, KL "A-Design" wrote in message ... Hi, I am using Shell ("c:\Program Files\X\X.EXE") to run another program from excel , now how can I make this code to open a specific file for me actually in this case both excel and X application are using the same file name but the extensions are like 04094.xls and 04094.XXX . Thanks in advance. Afshin |
Call other application from excel
Can either of you tell me how I would use shell to accomplish this task I have macro's that have been created via VB in EXCEL - I have been asked to 'add' to the macro a method of notification - I know I can do the below command via a DOS prompt net send 157.159.99.123 hi this is the message I am sending net send 157.159.99.124 you to also need to recv a message I would like to find a way to send a message such as those above to 'specific IPs ' on my net work with in the macro is this possible? (I do not need to use the exact command as shown above but I do need it sent to either the IP or a group ) "A-Design" wrote: That is it, Thank you KL, "KL" wrote in message ... If I understand correctly you are asking about this: fileOpen = Shell("c:\Program Files\X\X.EXE " & "c:\myfolder\04094.XXX", vbMaximizedFocus) KL "KL" wrote in message ... Not sure I fully understand what you are trying to achieve. maybe this will help you: fileOpen = Shell("notepad.exe " & fileName, vbMaximizedFocus) or if you want to use an office application you may look at this (Activating Other Applications with Excel VBA section): http://www.geocities.com/jonpeltier/Excel/XL_PPT.html regards, KL "A-Design" wrote in message ... Hi, I am using Shell ("c:\Program Files\X\X.EXE") to run another program from excel , now how can I make this code to open a specific file for me actually in this case both excel and X application are using the same file name but the extensions are like 04094.xls and 04094.XXX . Thanks in advance. Afshin |
Call other application from excel
Kathy
you could try the shellwait function (not fully tested) RetVal = Shell("command.com /c nbtstat -a " & sMachineID , 0) based on the snippet of code that does/did work: RetVal = Shell("command.com /c nbtstat -a " & sMachineID & " " & Environ$("temp") & "\" & sMachineID & ".txt", 0) hth Tim the shellwait code is reproduced below incl a dummy test (put code in its own module for convenience): Option Explicit Private Const PROCESS_QUERY_INFORMATION As Long = &H400 Private Const STILL_ACTIVE As Long = &H103 Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As _ Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As _ Long, lpExitCode As Long) As Long Sub TestShellAndWait() Dim Ret_Val_ ShellAndWait ("command.com /c dir s: c:\temp\junk.txt") 'ShellAndWait ("command.com dir c:\*.* c:\temp\junk.txt") End Sub ''' Arguments: szCommandLine The command line to execute using Shell. ''' iWindowState (Optional) The window state parameter to pass ''' to the Shell function. Default = vbHide. ''' See Shell function help for other options. Sub ShellAndWait(ByVal szCommandLine As String, Optional ByVal iWindowState As _ Integer = vbHide) Dim lTaskID As Long Dim lProcess As Long Dim lExitCode As Long Dim lResult As Long ''' Run the Shell function. lTaskID = Shell(szCommandLine, iWindowState) ''' Get the process handle from the task ID returned by Shell. lProcess = OpenProcess(PROCESS_QUERY_INFORMATION, 0&, lTaskID) ''' Loop while the shelled process is still running. Do ''' lExitCode will be set to STILL_ACTIVE as long as the shelled process is running. lResult = GetExitCodeProcess(lProcess, lExitCode) DoEvents Loop While lExitCode = STILL_ACTIVE End Sub "Kathy" wrote in message ... Can either of you tell me how I would use shell to accomplish this task I have macro's that have been created via VB in EXCEL - I have been asked to 'add' to the macro a method of notification - I know I can do the below command via a DOS prompt net send 157.159.99.123 hi this is the message I am sending net send 157.159.99.124 you to also need to recv a message I would like to find a way to send a message such as those above to 'specific IPs ' on my net work with in the macro is this possible? (I do not need to use the exact command as shown above but I do need it sent to either the IP or a group ) "A-Design" wrote: That is it, Thank you KL, "KL" wrote in message ... If I understand correctly you are asking about this: fileOpen = Shell("c:\Program Files\X\X.EXE " & "c:\myfolder\04094.XXX", vbMaximizedFocus) KL "KL" wrote in message ... Not sure I fully understand what you are trying to achieve. maybe this will help you: fileOpen = Shell("notepad.exe " & fileName, vbMaximizedFocus) or if you want to use an office application you may look at this (Activating Other Applications with Excel VBA section): http://www.geocities.com/jonpeltier/Excel/XL_PPT.html regards, KL "A-Design" wrote in message ... Hi, I am using Shell ("c:\Program Files\X\X.EXE") to run another program from excel , now how can I make this code to open a specific file for me actually in this case both excel and X application are using the same file name but the extensions are like 04094.xls and 04094.XXX . Thanks in advance. Afshin |
Call other application from excel
KL,
Have you tried this on your system ? Is it working for you ? please see my 2nd post that I have sent yesterday. Thanks, Afshin "KL" wrote in message ... If I understand correctly you are asking about this: fileOpen = Shell("c:\Program Files\X\X.EXE " & "c:\myfolder\04094.XXX", vbMaximizedFocus) KL "KL" wrote in message ... Not sure I fully understand what you are trying to achieve. maybe this will help you: fileOpen = Shell("notepad.exe " & fileName, vbMaximizedFocus) or if you want to use an office application you may look at this (Activating Other Applications with Excel VBA section): http://www.geocities.com/jonpeltier/Excel/XL_PPT.html regards, KL "A-Design" wrote in message ... Hi, I am using Shell ("c:\Program Files\X\X.EXE") to run another program from excel , now how can I make this code to open a specific file for me actually in this case both excel and X application are using the same file name but the extensions are like 04094.xls and 04094.XXX . Thanks in advance. Afshin |
All times are GMT +1. The time now is 03:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com