Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default execute a .exe file and type a text string by vba on it

Hi all,

I have a software ending with .exe that i would like to open, type
the
word 'select' on it, press 'enter' and make it run from excel.


I used the following code but vba doesn't recognize 'wd' as an
application but as a number.


Dim wd As Application


wd = Shell("Y:\--\Sel.exe", 1)


Application.SendKeys "select"


Do you have any clues about?


Thanks,
Marco

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default execute a .exe file and type a text string by vba on it

Marco,
Check the help for the Shell function.
You will see that it returns a Variant (Double), which is the PID.
In Excel VBA, "Application" will refer to Excel application, not just any
application.

Also, you can use vbNormalFocus in place of 1 for clarity.

Note that there are 2 versions of SendKeys:
Application.SendKeys
VBA.SendKeys

The first is Excel's, the second VBA's.
Whilst it may not matter in your case, I have read there are subtle
differences between the 2.

I assume you have checked that there is no better way of interacting with
this exe ?
Command line, DDE, automation ?

NickHK

"Marco" wrote in message
oups.com...
Hi all,

I have a software ending with .exe that i would like to open, type
the
word 'select' on it, press 'enter' and make it run from excel.


I used the following code but vba doesn't recognize 'wd' as an
application but as a number.


Dim wd As Application


wd = Shell("Y:\--\Sel.exe", 1)


Application.SendKeys "select"


Do you have any clues about?


Thanks,
Marco



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 do you save an excel file to be read as IBM-type text file ? Dee Franklin Excel Worksheet Functions 2 October 10th 06 02:46 AM
Run/Execute string expression Hammas Excel Programming 0 September 29th 05 05:13 AM
Evaluate and execute a string Randall[_6_] Excel Programming 3 August 4th 05 05:19 PM
Hyperlink - execute a "Back/Previous" type of functionality A C Excel Discussion (Misc queries) 0 June 20th 05 10:59 PM
Changing a specific character type in text string olasa Excel Discussion (Misc queries) 0 March 20th 05 11:35 PM


All times are GMT +1. The time now is 09:41 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"