Hello,
I am trying to write VBA code that allows a user to update links by selecting the file and updating.
This is what I have but some how the link range is changing causing the linked image to be cut in half.
Can someone PLEASE HELP!!
Dim In_file As Variant
Dim dlgOpen As FileDialog
Dim linkpos As Integer
Dim i As Integer
Dim k As Integer
Dim linkname As String
Set dlgOpen = Application.FileDialog(Type:=msoFileDialogOpen)
dlgOpen.AllowMultiSelect = False
For i = 1 To ActivePresentation.Slides.Count
With ActivePresentation.Slides(i)
For k = 1 To .Shapes.Count
With .Shapes(k)
If .Type = msoLinkedOLEObject Then
If dlgOpen.Show = -1 Then
In_file = dlgOpen.SelectedItems.Item(1)
End If
With .LinkFormat
linkpos = InStr(1, .SourceFullName, "!", _
vbTextCompare)
linkname = Right(.SourceFullName, Len(.SourceFullName) - linkpos)
.SourceFullName = In_file & linkname
.AutoUpdate = ppUpdateOptionAutomatic
End With
End If
End With
Next k
End With
Next i
ActivePresentation.UpdateLinks
End Sub
I am trying to write VBA code that allows a user to update links by selecting the file and updating.
This is what I have but some how the link range is changing causing the linked image to be cut in half.
Can someone PLEASE HELP!!
Dim In_file As Variant
Dim dlgOpen As FileDialog
Dim linkpos As Integer
Dim i As Integer
Dim k As Integer
Dim linkname As String
Set dlgOpen = Application.FileDialog(Type:=msoFileDialogOpen)
dlgOpen.AllowMultiSelect = False
For i = 1 To ActivePresentation.Slides.Count
With ActivePresentation.Slides(i)
For k = 1 To .Shapes.Count
With .Shapes(k)
If .Type = msoLinkedOLEObject Then
If dlgOpen.Show = -1 Then
In_file = dlgOpen.SelectedItems.Item(1)
End If
With .LinkFormat
linkpos = InStr(1, .SourceFullName, "!", _
vbTextCompare)
linkname = Right(.SourceFullName, Len(.SourceFullName) - linkpos)
.SourceFullName = In_file & linkname
.AutoUpdate = ppUpdateOptionAutomatic
End With
End If
End With
Next k
End With
Next i
ActivePresentation.UpdateLinks
End Sub