New user setup requirement. They must have a desktop shortcut to a specific folder that opens a SharePoint site using windows explorer.
Here's the code I think should be on the button, that isn't working. Very likely operator error.
Compile error expect =
The Public Function is
Here's the code I think should be on the button, that isn't working. Very likely operator error.
Compile error expect =
Code:
Private Sub Command29_Click()
fnCreateShortcut ("Database_Shortcut", "\\sharepointxxxxxx.com\Files")
End Sub
The Public Function is
Code:
Public Function fnCreateShortcut(strName As String, strAppPath As String, strIconPath As String, strDesc As String)
'https://social.msdn.microsoft.com/Forums/en-US/2e03b9d1-8a0f-44e6-a5fc-6c08a5f05138/creating-shortcuts-in-vba-for-windows-xp-and-7-using-wshshortcut-problems?forum=isvvba
' this function creates a desktop shortcut for any file or folder or application
' You need to reference Windows Script Host Object Mode for the code to work
Dim WshShell, strDesktop, oShellLink
Set WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
'we first check that the object does not exist already
If (Dir(strfilepath & "\" & strName & ".lnk") = "") Then
Set oShellLink = WshShell.CreateShortcut(strDesktop & "\" & strName & ".lnk")
With oShellLink
.TargetPath = strAppPath
.WindowStyle = 1
.Hotkey = "CTRL+W"
.IconLocation = strIconPath
.Description = strDesc
.WorkingDirectory = strDesktop
.Save
End With
End If
End Function