run cmd without using batch on VBA
" I want to run the code in batch file in VBA without having to run batch file "
mean that i want use the command that get same result from batch file in VBA
So i dont have to use batch in my work , only use VBA to run CMD and run the command line or some Solution similar
i have try but i just new to VBA and programing ,i need some help T^T
here the code
this is from batch
--------------------------------------------------------------------------------------
@echo off
>summary.txt (
for %%F in (*chkpackage.log) do findstr /l %1 "%%F" nul||echo %%F:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A:N/A
)
--------------------------------------------------------------------------------
and this is code in vba
FileSet = Sheet1.Range("C13")
txtFpath = Sheet1.Range("C7").Value
FilePath = txtFpath & "\res.bat"
ChDrive "C"
RSP = Shell(Environ$("COMSPEC"), vbNormalFocus)
Application.Wait Now + TimeValue("00:00:01")
SendKeys "CD " & txtFpath & "{ENTER}", True
Application.Wait Now + TimeValue("00:00:01")
SendKeys "start " & FilePath & " " & FileSet & "{ENTER}", True
Application.Wait Now + TimeValue("00:00:15")
SendKeys "exit " & "{ENTER}", True
Application.Wait Now + TimeValue("00:00:01")
SendKeys "exit " & "{ENTER}", True
any suggestion ?
i have to admit that i'm really not good in programing if you can add some explaination is a great thing for me to try to study
thank you
I'm not entirely clear on
I'm not entirely clear on what you want so I'll start the ball rolling with a simple piece of VBA code to open a text file in Excel
Sub OpenTxtFile()
Workbooks.OpenText Filename:="C:\Test.txt", _
Origin:=xlMSDOS, _
StartRow:=1, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=True, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=False, _
FieldInfo:=Array(1, 1), _
TrailingMinusNumbers:=True
End Sub
i'm trying to find the best
i'm trying to find the best explain of my problem but i'm not native english sorry T^T
i already edited the question
if you can please help again thank you :D