Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Shell command ignores variable

Hi,

I have a macro that uses psexec to launch presentations on remote machines,
in the macro I capture the workstation name and the file name from cells and
pass it to the psexec command line, only problem is the command ignores the
first variable.

WKSTN = "\\" & Range("N8").Text
TargetFile = Range("B7").Value

Shell ("c:\PRES\psexec & WKSTN -e -i -d ""c:\program files\microsoft
office\office11\pptview.exe"" /S c:\pres\" & TargetFile)

If I amend to
Shell ("c:\PRES\psexec \\WorkstationName -e -i -d ""c:\program
files\microsoft office\office11\pptview.exe"" /S c:\pres\" & TargetFile)
It works fine

Using & WKSTN the variable does not get passed to the command line and
psexec tries to launch & WKSTN

Any help appreciated

Regards and thanks

Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Shell command ignores variable

You didn't implement the concatenation correctly. Try it this way...

Shell ("c:\PRES\psexec " & WKSTN & "-e -i -d ""c:\program files\microsoft
office\office11\pptview.exe"" /S c:\pres\" & TargetFile)

--
Rick (MVP - Excel)


"Paul" wrote in message
...
Hi,

I have a macro that uses psexec to launch presentations on remote
machines, in the macro I capture the workstation name and the file name
from cells and pass it to the psexec command line, only problem is the
command ignores the first variable.

WKSTN = "\\" & Range("N8").Text
TargetFile = Range("B7").Value

Shell ("c:\PRES\psexec & WKSTN -e -i -d ""c:\program files\microsoft
office\office11\pptview.exe"" /S c:\pres\" & TargetFile)

If I amend to
Shell ("c:\PRES\psexec \\WorkstationName -e -i -d ""c:\program
files\microsoft office\office11\pptview.exe"" /S c:\pres\" & TargetFile)
It works fine

Using & WKSTN the variable does not get passed to the command line and
psexec tries to launch & WKSTN

Any help appreciated

Regards and thanks

Paul


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Shell command ignores variable

Rick

Thanks for your prompt response, it's amazing what a couple of missing
quotation marks and an ampersand can do to a line of code....now works
Thanks

"Rick Rothstein" wrote in message
...
You didn't implement the concatenation correctly. Try it this way...

Shell ("c:\PRES\psexec " & WKSTN & "-e -i -d ""c:\program files\microsoft
office\office11\pptview.exe"" /S c:\pres\" & TargetFile)

--
Rick (MVP - Excel)


"Paul" wrote in message
...
Hi,

I have a macro that uses psexec to launch presentations on remote
machines, in the macro I capture the workstation name and the file name
from cells and pass it to the psexec command line, only problem is the
command ignores the first variable.

WKSTN = "\\" & Range("N8").Text
TargetFile = Range("B7").Value

Shell ("c:\PRES\psexec & WKSTN -e -i -d ""c:\program files\microsoft
office\office11\pptview.exe"" /S c:\pres\" & TargetFile)

If I amend to
Shell ("c:\PRES\psexec \\WorkstationName -e -i -d ""c:\program
files\microsoft office\office11\pptview.exe"" /S c:\pres\" & TargetFile)
It works fine

Using & WKSTN the variable does not get passed to the command line and
psexec tries to launch & WKSTN

Any help appreciated

Regards and thanks

Paul


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
How to run a shell command via VBA? Benjamin Excel Programming 7 August 18th 10 09:43 AM
Shell command ignores parameters Pete[_22_] Excel Programming 2 February 15th 05 08:07 AM
Shell command ignores parameters Pete[_22_] Excel Programming 0 February 8th 05 04:39 PM
Shell Command JOHN Excel Programming 1 November 17th 04 10:39 AM
xp shell command using vba Sudhendra Excel Programming 2 February 16th 04 05:56 AM


All times are GMT +1. The time now is 01:05 AM.

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"