VB创建快捷方式的简易方法--运用Wscript.Shell

来源:互联网 发布:ip与mac绑定设置 编辑:程序博客网 时间:2024/05/23 18:33

Sub SetShortCut(ByVal lnkTarget As String, ByVal lnkFilePathName As String)

On Error Resume Next
'By 同济黄正 http://fine3x.com
Dim Lnk As Object
Set Lnk = CreateObject("Wscript.Shell").CreateShortcut(lnkFilePathName)
If Lnk Is Nothing Then Exit Sub    ' MsgBox "不支持Wscript.Shell。", vbCritical:
Lnk.TargetPath = lnkTarget
Lnk.Save
Set Lnk = Nothing
End Sub

 

原创粉丝点击