View Single Post
 
Old 06-08-2016, 06:45 AM
JohnWilson JohnWilson is offline Windows 7 64bit Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,914
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

You are starting to get into more complex programming!

This will open the first file whose name starts with "Presentation" in a folder.

I wouldn't make the folder "C:\" and I would consider a different prefix than "Presentation"

Here's the basic of finding a matching file name using the File Scripting Object (fso).
Code:
Sub WildCard()

Dim fso As Object
Dim oFile As Object
Dim oFolder As Object
Dim FolderPath As String
Dim opres As Presentation
FolderPath = "C:\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(FolderPath)
For Each oFile In oFolder.Files
If oFile.Name Like "Presentation*" Then
Presentations.Open oFile.Path
Exit For
End If
Next oFile
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote