可以excel启动.bat文件? (VBA,宏等) [英] Can excel launch .bat file? (VBA, macro etc)
问题描述
如何从 .bat 文件class =post-tagtitle =显示问题标记excelrel =tag> excel ?例如通过事件或按钮?
是否可以在Excel中构建一个 .bat
文件?例如,我从Excel构建了一个可启动的 .bat
文件,一个用户从服务器下载我的Excel文件,然后这个Excel文件可以启动 .bat
文件?
运行蝙蝠文件 >
要从vba调用 .bat
文件,可以使用 shell
function:
Sub test()
Call Shell(Environ $(COMSPEC)& c C:\Path.bat,vbNormalFocus)
End Sub
注意:/ / /完成后关闭DOS提示符。
从Excel创建一个.bat文件
您可以使用VBA创建一个文件(一个 .bat
或其他),以便它可以是一个txt,一个蝙蝠或一个日志文件代码似乎是一样的。
以下是一些开始的链接:
How I can launch a .bat
file from excel? For example via an event or a button?
And is it possible to build a .bat
file into Excel? For example, I build a launchable .bat
file from Excel, a user downloads my Excel file from a server, and then this Excel file can launch the .bat
file?
Running a bat file
To call a .bat
file from vba, you can use the shell
function:
Sub test()
Call Shell(Environ$("COMSPEC") & " /c C:\Path.bat", vbNormalFocus)
End Sub
Note: the /c closes the DOS prompt when finished.
Creating a .bat file from Excel
You can create a file (a .bat
or whatever) with VBA so it could be a txt, a bat or a log file, code is seemingly the same.
Here are some links to begin with:
- create a log file
- exporting a text file from Chip Pearson
- read file
这篇关于可以excel启动.bat文件? (VBA,宏等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!