自动化错误创建快捷方式

时间:2016-02-04 15:12:05

标签: excel vba

我创造了以下内容,此刻它给我带来了麻烦!

我看不出为什么这不起作用的任何理由,它适用于通用网址 - 只是当我尝试在特定浏览器中打开网址时

Function Quote(inputText As String) As String
  Quote = Chr(34) & inputText & Chr(34)
End Function

Sub CreateShortCut()
 Dim oWSH As Object
 Dim oShortcut As Object
 Dim sPathDeskTop As String
 Dim tPath As String


 tPath = Quote("C:\Program Files (x86)\Microsoft Application Virtualization Client\sfttray.exe") & " /exe ff.exe " & Quote("Mozilla Firefox 38.3.0.0.1.V04") & " https://dwp.reach-interactive.com/account/login/"



Set oWSH = CreateObject("WScript.Shell")
 sPathDeskTop = oWSH.SpecialFolders("Desktop")

Set oShortcut = oWSH.CreateShortCut(sPathDeskTop & "\" & _
 "Example Shortcut" & ".url")
 With oShortcut
 .TargetPath = tPath
 .Save
 End With
 Set oWSH = Nothing
 MsgBox "Shortcut Created!"
 ActiveWorkbook.Close

End Sub

0 个答案:

没有答案