Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2006
    Posts
    2

    Unanswered: VBS-function for changing a file-link

    Hallo,

    I'm serching a tool to change the destination of a file-link automaticaly.
    How to change the destination depends from serveral conditions.
    I want to program my self, but I don't know, how I have to define the necessary object and which properties i can use.

    Can You help me?

  2. #2
    Join Date
    Jun 2006
    Posts
    2
    Completion:
    I have found an Object for listing the file-link, but the try to change the entry takes no effect (Examble in MS Excel VBA):

    Sub ChangeLink()
    Dim s As New Shell
    Dim f As Folder3
    Dim fI As FolderItem
    Dim NewPath As String

    Dim i As Long, Anz As Long, Change As Long,, Changed As Long

    LastPath = "S:\Informationen"
    Do
    Set f = Nothing
    Set f = s.BrowseForFolder(Application.Hwnd, _
    "Bitte Import-Ordner waehlen:", _
    0&, _
    "S:\Informationen")
    If Not f Is Nothing Then
    Anz = 0
    Change = 0
    For i = 0 To f.Items.Count - 1
    Set fI = f.Items.Item(i)
    If fI.IsLink Then
    If fI.GetLink.Path Like "P:\*" Then
    NewPath = \\server\volume\ & Mid$(fI.GetLink.Path, 3)
    If MsgBox("Verknüpfung '" & fI.Path & "\" & fI.Name & "' von '" & _
    fI.GetLink.Path & "' in '" & NewPath & "' ändern?", _
    vbQuestion + vbDefaultButton2 + vbYesNo, _
    "Verknüpfung aktualisieren?") = vbYes _
    Then
    fI.GetLink.Path = NewPath
    Changed = Changed + 1
    End If
    Change = Change + 1
    End If
    Anz = Anz + 1
    End If
    Set fI = Nothing
    Next i
    If Anz = 0 Then
    MsgBox "Im Pfad " & f.Self.Path & " wurden keine Links gefunden!"
    Else
    MsgBox "Im Pfad " & f.Self.Path & " wurden " & Anz & " Links gefunden." & vbCrLf & _
    "Davon wären " & Change & " Einträge zu ändern, " & Changed & " wurden geändert!"
    End If
    End If
    Loop Until f Is Nothing
    Set f = Nothing
    End Sub

Posting Permissions

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