+ -
当前位置:首页 → 问答吧 → VBA 中 Shell 的用法

VBA 中 Shell 的用法

时间:2011-07-25

来源:互联网

以下指令在Dos下能够将注册表指定的字段写入文档
reg export  "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" D:\s.reg
在VBA中怎样实现?

作者: ngcg   发布时间: 2011-07-25

Dim WshShell As Object
Set WshShell = CreateObject("Wscript.Shell")
Dim txtR As String, pp
txtR = "D:\s.reg"
If Dir(txtR) = "" Then '不存在则添加一空文件
Open txtR For Output As #2
pp = WshShell.Regread("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts")
Print #2, pp
Close
End If
Set WshShell = Nothing

作者: sqhsqhli   发布时间: 2011-07-25

热门下载

更多