Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
PJ PJ is offline
external usenet poster
 
Posts: 112
Default Launch external program - Compile error: Expected: list separator

I need to launch an external program using a macro and open a project in the
process. The executable file resides on a shared drive as does the project I
need to open. I've looked at the shell command but can't figure out how to
pass the variables. I keep receiving the following message:

Compile error:
Expected: List separator or )

There is a different version of the software installed on the local hard
drive and it will try to open the project from there, but that won't work.
So I need to specify the "start in" folder for it to work properly.

Program resides he
g:\apps\my prog\myprog.exe

Project resides he
g:\files\ my project\myprojname.xxx

So I have this but it doesn't work. How can I modify it so it will launch
using the executable from the shared drive?
RetVal = Shell("g:\apps\my prog\myprog.exe" "g:\files\ my
project\myprojname.xxx", 1)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Launch external program - Compile error: Expected: list separator

This does it for me, but it's not VBA.

Dim objProj
Dim objVisio
Dim objShell
Dim objFSO
Dim fPath
Dim fName
Dim intSleep
Dim objWMIService
Dim colProcess
Dim objProcess
Dim strName
Dim strComputer
Dim myObj

intSleep = 15000

strComputer = "."
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

fPath = "C:\Program Files\MINITAB 14"
fName = "Mtb14.exe"


If objFSO.FileExists(fPath & "\" & fName) then


objshell.currentdirectory = fpath
objShell.run fName
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & "'" & fname & "'")

For Each objProcess in colProcess
objProcess.Terminate()
Next
End if

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"PJ" wrote:

I need to launch an external program using a macro and open a project in the
process. The executable file resides on a shared drive as does the project I
need to open. I've looked at the shell command but can't figure out how to
pass the variables. I keep receiving the following message:

Compile error:
Expected: List separator or )

There is a different version of the software installed on the local hard
drive and it will try to open the project from there, but that won't work.
So I need to specify the "start in" folder for it to work properly.

Program resides he
g:\apps\my prog\myprog.exe

Project resides he
g:\files\ my project\myprojname.xxx

So I have this but it doesn't work. How can I modify it so it will launch
using the executable from the shared drive?
RetVal = Shell("g:\apps\my prog\myprog.exe" "g:\files\ my
project\myprojname.xxx", 1)

  #3   Report Post  
Posted to microsoft.public.excel.programming
PJ PJ is offline
external usenet poster
 
Posts: 112
Default Launch external program - Compile error: Expected: list separa

Hi Barb,

I tried using the code but can't get it to work. It does not like the
objProcess.Terminate() line, so I remarked that out. But it still doesn't do
anything. In the debugger, the IF statement must translate to false as it
skips over everything and goes to the end. If I try removing the IF
statement, it gives me an error on the next line (objShell.currentdirectory).

Thanks for the suggestion though.

"Barb Reinhardt" wrote:

This does it for me, but it's not VBA.

Dim objProj
Dim objVisio
Dim objShell
Dim objFSO
Dim fPath
Dim fName
Dim intSleep
Dim objWMIService
Dim colProcess
Dim objProcess
Dim strName
Dim strComputer
Dim myObj

intSleep = 15000

strComputer = "."
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

fPath = "C:\Program Files\MINITAB 14"
fName = "Mtb14.exe"


If objFSO.FileExists(fPath & "\" & fName) then


objshell.currentdirectory = fpath
objShell.run fName
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & "'" & fname & "'")

For Each objProcess in colProcess
objProcess.Terminate()
Next
End if

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"PJ" wrote:

I need to launch an external program using a macro and open a project in the
process. The executable file resides on a shared drive as does the project I
need to open. I've looked at the shell command but can't figure out how to
pass the variables. I keep receiving the following message:

Compile error:
Expected: List separator or )

There is a different version of the software installed on the local hard
drive and it will try to open the project from there, but that won't work.
So I need to specify the "start in" folder for it to work properly.

Program resides he
g:\apps\my prog\myprog.exe

Project resides he
g:\files\ my project\myprojname.xxx

So I have this but it doesn't work. How can I modify it so it will launch
using the executable from the shared drive?
RetVal = Shell("g:\apps\my prog\myprog.exe" "g:\files\ my
project\myprojname.xxx", 1)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile Error: Expected Array BEEJAY Excel Programming 7 December 8th 08 08:23 PM
compile error - expected an array John Excel Programming 8 September 21st 06 08:04 PM
compile error: Expected: = ...Why? cesw[_2_] Excel Programming 3 September 10th 05 12:41 AM
Compile Error: Expected End Property George J[_3_] Excel Programming 4 August 3rd 05 03:35 PM
compile error: expected variable or function MMM Excel Discussion (Misc queries) 3 December 24th 04 03:11 PM


All times are GMT +1. The time now is 06:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"