M
Michal
Hi,
I need to prepare a navigator - mini presentation with few slides that
will have hyperlinks to Excel files.
The excel files have predictable names, but the name change with the
data waves coming. The Excel files can be in the same folder or in
subfolder - at the end of the day I'll prepare a portable presentation
and send it with a viewer, so the hyperlinks will be relative anyway.
The number of hyperlins may change a bit. The ideal situation would be
if the links were in textboxes, so I can check the text in the box
and, on the basis of it, find the proper file for each link. The list
of text-link may be prepared in Excel worksheet for example.
I have found some hints how to change the links, but the examples use
msoLinkedOLEObject and after that .LinkFormat that does not work with
text boxes. This is great for updating charts source data, but I don't
know how to use is in my case.
Below I enclose the quoted hints found on this newsgroup (thanks for
Shyam Pillai)
I'd be verz grateful for any ideas how to solve it.
Regrads,
Michal
Liczba trafień 2
Autor:Shyam Pillai ([email protected])
Temat:Re: Code to change an Excel Object source file
View: Complete Thread (liczba dokumentów: 2)
Original Format
Grupy dyskusyjne:microsoft.public.powerpoint
Data:2002-03-21 18:14:50 PST
Glauco,
I am not very sure about the requirement, do you wish to change the
name of
the source path information.
Here is an example of updating links. I'm sure you could make the
necessary
modifications to suit it to your needs. This example updates all the
linked
file paths to reflect the new path "C:\Documents and
Settings\Documents\"
'------ Code begins here -----
Public Const NewLinkPath = "C:\Documents and Settings\Documents\"
Sub UpdateToNewLinks()
Dim I As Integer
Dim J As Integer
' Create a variable to store the file reference string.
Dim LinkFileName As String
' Set a For loop to go from slide 1 to the last slide in the
presentation.
For I = 1 To ActivePresentation.Slides.Count
' Select the slide based on the index value.
With ActivePresentation.Slides(I)
' Loop through all the objects on slide.
For J = 1 To .Shapes.Count
' Use only shapes on the slide.
With .Shapes(J)
' If the shape's type is an OLE object then...
If .Type = msoLinkedOLEObject Then
' Ideally you should determine the type of OLE Object before working
on it.
' In this case I am assuming only wav/avi files have been linked.
' Change the path to new source and set the update type to Automatic.
With .LinkFormat
' Now we shall extract the filename from the complete path.
ExtractFilename
is a function
' written by me to extract only the filename from a fully qualified
path.
' Write your own "ExtractFileName" function. I have not included the
code
for it
' In case you have difficulty with it then get in touch with me.
LinkFileName = ExtractFilename(.SourceFullName)
' Concatinate the new Path and filename and assign it to the
SourceFullName
.SourceFullName = NewLinkPath & LinkFileName
.AutoUpdate = ppUpdateOptionAutomatic
End With
End If
End With
Next J
End With
Next I
' Update all links in the presentation, so that the changes are
' visible and the source file locations are correct on the screen.
ActivePresentation.UpdateLinks
End Sub
' -------- Code ends here ---------
Regards
Shyam Pillai
Handout Wizard
http://www.mvps.org/skp/how/
I need to prepare a navigator - mini presentation with few slides that
will have hyperlinks to Excel files.
The excel files have predictable names, but the name change with the
data waves coming. The Excel files can be in the same folder or in
subfolder - at the end of the day I'll prepare a portable presentation
and send it with a viewer, so the hyperlinks will be relative anyway.
The number of hyperlins may change a bit. The ideal situation would be
if the links were in textboxes, so I can check the text in the box
and, on the basis of it, find the proper file for each link. The list
of text-link may be prepared in Excel worksheet for example.
I have found some hints how to change the links, but the examples use
msoLinkedOLEObject and after that .LinkFormat that does not work with
text boxes. This is great for updating charts source data, but I don't
know how to use is in my case.
Below I enclose the quoted hints found on this newsgroup (thanks for
Shyam Pillai)
I'd be verz grateful for any ideas how to solve it.
Regrads,
Michal
Liczba trafień 2
Autor:Shyam Pillai ([email protected])
Temat:Re: Code to change an Excel Object source file
View: Complete Thread (liczba dokumentów: 2)
Original Format
Grupy dyskusyjne:microsoft.public.powerpoint
Data:2002-03-21 18:14:50 PST
Glauco,
I am not very sure about the requirement, do you wish to change the
name of
the source path information.
Here is an example of updating links. I'm sure you could make the
necessary
modifications to suit it to your needs. This example updates all the
linked
file paths to reflect the new path "C:\Documents and
Settings\Documents\"
'------ Code begins here -----
Public Const NewLinkPath = "C:\Documents and Settings\Documents\"
Sub UpdateToNewLinks()
Dim I As Integer
Dim J As Integer
' Create a variable to store the file reference string.
Dim LinkFileName As String
' Set a For loop to go from slide 1 to the last slide in the
presentation.
For I = 1 To ActivePresentation.Slides.Count
' Select the slide based on the index value.
With ActivePresentation.Slides(I)
' Loop through all the objects on slide.
For J = 1 To .Shapes.Count
' Use only shapes on the slide.
With .Shapes(J)
' If the shape's type is an OLE object then...
If .Type = msoLinkedOLEObject Then
' Ideally you should determine the type of OLE Object before working
on it.
' In this case I am assuming only wav/avi files have been linked.
' Change the path to new source and set the update type to Automatic.
With .LinkFormat
' Now we shall extract the filename from the complete path.
ExtractFilename
is a function
' written by me to extract only the filename from a fully qualified
path.
' Write your own "ExtractFileName" function. I have not included the
code
for it
' In case you have difficulty with it then get in touch with me.
LinkFileName = ExtractFilename(.SourceFullName)
' Concatinate the new Path and filename and assign it to the
SourceFullName
.SourceFullName = NewLinkPath & LinkFileName
.AutoUpdate = ppUpdateOptionAutomatic
End With
End If
End With
Next J
End With
Next I
' Update all links in the presentation, so that the changes are
' visible and the source file locations are correct on the screen.
ActivePresentation.UpdateLinks
End Sub
' -------- Code ends here ---------
Regards
Shyam Pillai
Handout Wizard
http://www.mvps.org/skp/how/