![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Location: Kitchener, Canada
Posts: 32
|
I'm trying to run a string of DOS commands using a macro. I'm completely lost.
I can do the task in DOS but don't know how to access it using VBA code. I've found sites that talk about doing it but can't find one that tells me how to do it. |
|
|
|
|
|
#2 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Waterloo, I hear they have a great CIS school up there (my Dad went there for Physics), the home of Cobalt (and y2k issues).
Most VBA comes from DOS, e.g, Dos commands, like Dir, copy, etc... have a functional purpose in VBA. Which commands are you trying to run? _________________ Cheers, NateO [ This Message was edited by: NateO on 2002-05-22 07:26 ] |
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Location: Kitchener, Canada
Posts: 32
|
I picked up a Physics minor Waterloo 5 years ago. Small world.
We've got a telnet mail server and I'm opening it up with "telnet 111.111.1.1 11" when I'm in DOS. Then I'm sending an email from an anonymous email...we're using this for a Q&A program. |
|
|
|
|
|
#4 |
|
New Member
Join Date: Feb 2002
Location: Kitchener, Canada
Posts: 32
|
I picked up a Physics minor Waterloo 5 years ago. Small world.
We've got a telnet mail server and I'm opening it up with "telnet 111.111.1.1 11" when I'm in DOS. Then I'm sending an email from an anonymous email...we're using this for a Q&A program. |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: May 2002
Location: Gothenburg, Sweden
Posts: 74
|
Use
Shell("your program")
__________________
/Niklas Jansson |
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
example of running Dos command; Sub RemoveDir_WithFiles() Shell "command.com /c RD C:mydir" End Sub Note: In Microsoft Excel, when you use the Shell function in a VBA macro to execute an external MS-DOS command, you should add the /c switch after command.com. This only applies to the Core commands DIR ,CLS,DEL ,CD,MD (MKDIR) ,RD (RMDIR),COPY BUT you can do these in VBA without shelling To run a Batch file just use; Sub DOSB() Dim varProc As Variant varProc = Shell("RunMe.bat", 6) End Sub |
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Feb 2002
Location: Kitchener, Canada
Posts: 32
|
I've got the macro to open the telnet.exe file. I now need to send information from Excel to the telnet session.
I'm trying to declare the telnet application as an object. How can I do that? |
|
|
|
|
|
#8 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Lookup this while in the VBA Editor for help |
|
|
|
|
|
|
#9 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Kobe, Japan
Posts: 1,420
|
Hi jjpkraft,
I don't know about telnet session very much. So just information... In case I am using another application (like as400) when need to send information, I always use like following.
HTH |
|
|
|
|
|
#10 |
|
New Member
Join Date: Feb 2002
Location: Kitchener, Canada
Posts: 32
|
Thanks everyone,
The sendkeys worked. Jason |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|