G
Geoff Cox
Hello,
The code below creates a menu slide by listing all the ppt files in
folder2 and creates a hyperlink link to each file.
I have just realised that I have used a back slash in the first path,
ie the path to folder2, BUT use a forward slash when creating the
hyperlink, ie Hyperlink.Address = etc!
I took the code from http://www.rdpslides.com/pptfaq/FAQ00291.htm
and Steve suggested the way for creating links to ppt files not in the
same folder as the menu slide. At the time I did not think about the
different types of slash - now I am!
The menu files appear to work OK but am worried that I may get a
problem at some point.
Any thoughts please?
Cheers
Geoff
Sub production_function()
Dim FileName As String
Dim LinkRange As TextRange
Dim targetFileSpec As String
Dim aFileNames() As String
Dim oTable As Shape
Dim x As Long
Dim y As Long
Dim lPointer As Long
targetFileSpec = "c:\folder1\folder2\*.PPT"
ReDim aFileNames(1 To 1) As String
FileName = Dir$(targetFileSpec)
While FileName <> ""
aFileNames(UBound(aFileNames)) = FileName
FileName = Dir$
ReDim Preserve aFileNames(1 To UBound(aFileNames) + 1) As String
Wend
ReDim Preserve aFileNames(1 To UBound(aFileNames) - 1) As String
Set oTable = ActiveWindow.Selection.ShapeRange(1)
lPointer = 1
For y = 1 To oTable.Table.Rows.Count
For x = 1 To oTable.Table.Columns.Count
oTable.Table.Cell(y, x).Shape.TextFrame.TextRange.Text =
aFileNames(lPointer)
Set LinkRange = _
oTable.Table.Cell(y,
x).Shape.TextFrame.TextRange.Characters(Start:=1,
Length:=Len(aFileNames(lPointer)))
LinkRange.ActionSettings(ppMouseClick).Hyperlink.Address =
"folder2/folder3/" & aFileNames(lPointer)
lPointer = lPointer + 1
Next ' x
Next ' y
End Sub
The code below creates a menu slide by listing all the ppt files in
folder2 and creates a hyperlink link to each file.
I have just realised that I have used a back slash in the first path,
ie the path to folder2, BUT use a forward slash when creating the
hyperlink, ie Hyperlink.Address = etc!
I took the code from http://www.rdpslides.com/pptfaq/FAQ00291.htm
and Steve suggested the way for creating links to ppt files not in the
same folder as the menu slide. At the time I did not think about the
different types of slash - now I am!
The menu files appear to work OK but am worried that I may get a
problem at some point.
Any thoughts please?
Cheers
Geoff
Sub production_function()
Dim FileName As String
Dim LinkRange As TextRange
Dim targetFileSpec As String
Dim aFileNames() As String
Dim oTable As Shape
Dim x As Long
Dim y As Long
Dim lPointer As Long
targetFileSpec = "c:\folder1\folder2\*.PPT"
ReDim aFileNames(1 To 1) As String
FileName = Dir$(targetFileSpec)
While FileName <> ""
aFileNames(UBound(aFileNames)) = FileName
FileName = Dir$
ReDim Preserve aFileNames(1 To UBound(aFileNames) + 1) As String
Wend
ReDim Preserve aFileNames(1 To UBound(aFileNames) - 1) As String
Set oTable = ActiveWindow.Selection.ShapeRange(1)
lPointer = 1
For y = 1 To oTable.Table.Rows.Count
For x = 1 To oTable.Table.Columns.Count
oTable.Table.Cell(y, x).Shape.TextFrame.TextRange.Text =
aFileNames(lPointer)
Set LinkRange = _
oTable.Table.Cell(y,
x).Shape.TextFrame.TextRange.Characters(Start:=1,
Length:=Len(aFileNames(lPointer)))
LinkRange.ActionSettings(ppMouseClick).Hyperlink.Address =
"folder2/folder3/" & aFileNames(lPointer)
lPointer = lPointer + 1
Next ' x
Next ' y
End Sub