Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-08-2016, 06:45 AM
JohnWilson JohnWilson is offline Open file which contains specific words in title Windows 7 64bit Open file which contains specific words in title 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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Open file which contains specific words in title Formatting all tables in doc with specific word in title jeffreybrown Word VBA 2 05-01-2016 06:05 PM
Export calendar events from multiple calendars with specific title rasmus Outlook 0 02-06-2015 01:58 AM
Open file which contains specific words in title Title bar in word and ecxel 2010 is not picking up greek file name of 2007 file danielle Word 4 12-03-2014 07:47 AM
Open file which contains specific words in title Formula to open external file with specific program (like open with) pemartins Excel 16 02-24-2014 11:39 PM
Open file which contains specific words in title Creating Text to count words WITHOUT title page ingmar.s Word 3 10-08-2009 10:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:02 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft