Help!! have I got this wrong?

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
 
S

Steve Rindsberg

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!

Hmmm. I don't really know whether this will cause problems down the road or not.
On the other hand, it should be fairly simple to step through a presentation and replace all
forward slashes in hyperlink addresses with backslashes at a later date, if need be, though
there'd need to be a bit of extra caution if you've used URL links as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top