0
votes

Consider VBA for PowerPoint - Is this a valid Presentations function call?

Presentations(".\directory\ppname.ppt")

Note that this will be called from within a PowerPoint presentation VBA, to open another one in a sub-directory.

The Microsoft Presentations examples (and most others) are not specific about the filename forms accepted, e.g. those using the ".", "..", "\" directives recognized in DOS scripts.

1
Are you using Presentations.Open? - BigBen
Presentations(filename) is not valid syntax. Use BigBen's suggestion to open a presentation. As to whether dot notations work or not ... try it! But at least some versions of PPT set the current directory to the one where the active file resides or not, depending on how the user's opened the presentation. Opening from the MRU list is liable to set the current directory to just about anything, often the Windows\Fonts folder. - Steve Rindsberg

1 Answers

0
votes

This seems to work with Powerpoint 2007.

As described in the comment, it takes a block of text (the TextRange), the starting position and length of file reference, also a LinkAddr. LinkAddr is essentially a DOS-style file reference, like "..\folder\ppfile.ppt".

The intention here is to launch another PowerPoint tool by invoking its show.ppt or show.ppsm file name. The file name can refer to some other directory using MSDOS file name stuff. I don't know whether it can span different machine platforms, but it seems to work within one Windows 10 system. My difficulty in getting this to work was some full-path links to images, e.g. something like C:\blah\blah\image.jpg, in the Visual Basic code. PowerPoint didn't like these, instead asked about enabling macros, and just hung up when one of my file links were to be executed. By getting rid of the "macro" complaints, this suddenly started working.

Or maybe some bugs have been fixed in recent repairs to my 2007 PowerPoint tools??

Go figure...

Sub InsertLink(ByRef Trange As TextRange, fpos As Long, msglen As Long, LinkAddr As String) ' Insert an HTML link into the selected TextFrame. ' get the character range Dim Hrange As TextRange Set Hrange = Trange.Characters(Start:=fpos, length:=msglen) ' make it an HTML link With Hrange.ActionSettings(ppMouseClick) .Action = ppActionHyperlink .Hyperlink.Address = LinkAddr End With End Sub