Results 1 to 2 of 2

Thread: Creating and using Symlinks in VBA?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Chatgpt has some answer:
    ' from Chatgpt
    Sub CreateSymlink(ByVal Target As String, ByVal Link As String)
        Dim cmd As String
        ' Ensure paths are wrapped in quotes
        ' cmd = "cmd /c mklink /D """ & Link & """ """ & Target & """"
        cmd = "cmd /c mklink """ & Link & """ """ & Target & """"
        ' Create the symbolic link
        Shell cmd, vbHide   'vbNormalFocus
    End Sub
    example (will create test.lnk of Document folder)
    Private Sub test()
        Dim path As String
        path = Environ("userprofile") & "\documents\"
        Call CreateSymlink(path & "fileNameHere.xlsx", path & "test.lnk")
    End Sub
    Last edited by Aussiebear; 06-26-2025 at 11:08 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •