VBA command to hyperlink to a file

  • Thread starter Victor and TJ Friedmann
  • Start date
V

Victor and TJ Friedmann

In my PPT2007 presentation I have the following macro designed to open a
file in the active window:

With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick).Action =
pptActionHyperlink
.Hyperlink.Address = "C:\Documents and Settings\My
Documents\cookbook\notes servings\mayonnaise.txt"

Nothing happens when I execute it even thought path is correct.

What is worn?

Thanks,

Vic
 
D

David Marcovitz

In my PPT2007 presentation I have the following macro designed to open a
file in the active window:

With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick).Action =
pptActionHyperlink
.Hyperlink.Address = "C:\Documents and Settings\My
Documents\cookbook\notes servings\mayonnaise.txt"

Nothing happens when I execute it even thought path is correct.

What is worn?

Thanks,

Vic

This code sets an action setting of the selected object to hyperlink (on
click) to the correct path. To use this code, you need to (in Normal View)
click on a shape, execute the macro (Alt-F8 and select and run the macro
that contains that code), go into Slide Show View, and then click on the
shape. Does this work? Is this what you want?
--David
--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
 
V

Victor and TJ Friedmann

Thanks for your response. I did what you suggested but when I press Alt f8
and then "run" I receive an error message "object required" and the debugger
highlights my path--which is correct. Any thoughts?

Vic
 
D

David Marcovitz

Did you click on the shape to select it before hitting Alt-F8? That code
requires a shape to be selected (the shape that will be assigned the
hyperlink).
--David

Thanks for your response. I did what you suggested but when I press Alt f8
and then "run" I receive an error message "object required" and the debugger
highlights my path--which is correct. Any thoughts?

Vic

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
 
V

verizon news groups

I'll double check and let you know.

Vic
David Marcovitz said:
Did you click on the shape to select it before hitting Alt-F8? That code
requires a shape to be selected (the shape that will be assigned the
hyperlink).
--David



--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
 
V

verizon news groups

John,

I quit early last night and have not looked at my problem yet. Yes, there is
an End With. Will update you later today.

Vic
 
V

Victor and TJ Friedmann

John,

Nope, still won't work. I get a 424 error and the debugger highlights my
path.

Here is the whole code:
Sub test3()

With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick).Action =
pptActionHyperlink
.Hyperlink.Address = "C:\Documents and Settings\My
Documents\cookbook\notes servings\mayonnaise.txt"



End With
End Sub
 
D

David Marcovitz

This code works; just watch out for line breaks introduced by the news
system:

Sub test3()
With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick)
.Action = pptActionHyperlink
.Hyperlink.Address = _
"C:\Documents and Settings\My Documents\cookbook\notes
servings\mayonnaise.txt"
End With
End Sub

I believe that your main problem was not starting a new line at .Action

--David

John,

Nope, still won't work. I get a 424 error and the debugger highlights my
path.

Here is the whole code:
Sub test3()

With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick).Action =
pptActionHyperlink
.Hyperlink.Address = "C:\Documents and Settings\My
Documents\cookbook\notes servings\mayonnaise.txt"



End With
End Sub

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
 

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