How to write message to command window from VBA?

2019-08-17 07:17发布

问题:

I have a simple requirement

I want to write 'Hello world' to windows cmd.exe from VBA (excel)

I referred 'Shell' and few other posts but could not do it

回答1:

The following worked:

strToPrint = "Hello World!"
Shell "cmd.exe /K echo " & strToPrint, vbNormalFocus


标签: vba cmd