Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Excel VBA脚本调用.reg文件_Vba_Excel - Fatal编程技术网

从Excel VBA脚本调用.reg文件

从Excel VBA脚本调用.reg文件,vba,excel,Vba,Excel,我想从VBA脚本中调用.reg文件。我正在使用Office/Excel 2013。 我知道Excel不能单独运行这些文件,所以我需要通过shell调用该文件。我编写的代码不起作用: Sub deactivateHyperlinkWarnings() Dim x x = Shell("cmd /C C:\TEMP\DisableHyperlinkWarnings.reg") End Sub 我在网上的某个地方找到了这段代码,但它不起作用。我甚至没有收到错误消息。.reg文件位于C

我想从VBA脚本中调用.reg文件。我正在使用Office/Excel 2013。 我知道Excel不能单独运行这些文件,所以我需要通过shell调用该文件。我编写的代码不起作用:

Sub deactivateHyperlinkWarnings()
    Dim x
    x = Shell("cmd /C C:\TEMP\DisableHyperlinkWarnings.reg")
End Sub
我在网上的某个地方找到了这段代码,但它不起作用。我甚至没有收到错误消息。.reg文件位于C:\TEMP中

我需要写什么才能让它工作


另外:运行.reg文件时是否可以抑制显示的消息框?当我手动启动文件时,我需要点击“OK”3次。稍后使用Excelsheet的人不应该看到这些东西

不要运行
cmd
尝试运行
reg
。因此,在您的情况下,它应该是
x=Shell(“reg import C:\TEMP\DisableHyperlinkWarnings.reg”)

更多信息