PDA

View Full Version : [SOLVED] Write and Read on cmd with VBA



ituarte
07-09-2015, 08:15 AM
Hello everyone,

I´m new with the VBA and i´m trainning by myself.

I´m trying to open cmd, write something on cmd, read what I wrote and save it on a cell of excel.

Well, I create a button and I got open the cmd:

Shell "cmd.exe"

Next step is write for example "hello world" on the cmd and readout it... but I have no idea how to do it.

Someone can help me???

Thks

JKwan
07-09-2015, 10:46 AM
try here:
http://www.snb-vba.eu/VBA_Fill_combobox_listbox_en.html

scroll a screen down and read up on "all files in a certain folder"

Kenneth Hobs
07-09-2015, 12:27 PM
Sub ken()
Range("A1").Value2 = CreateObject("Wscript.Shell").Exec("cmd /c echo Hello World!").StdOut.ReadAll
Range("A1").Speak
End Sub

snb
07-09-2015, 01:21 PM
Please start in VBA with something totally different (i.e. more simple)
Buy a book: 'VBA for dummies' and read it from the start to the end. That's the fastest way to learn this language.

ituarte
07-09-2015, 11:28 PM
Thank you so much !!!!