Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-29-2019, 02:26 PM
DaveP DaveP is offline Open Folder/File by Keyword Windows 10 Open Folder/File by Keyword Office 2010
Novice
Open Folder/File by Keyword
 
Join Date: May 2019
Posts: 11
DaveP is on a distinguished road
Default Open Folder/File by Keyword

Hello,

I'm trying to write a macro that will open a document from a separate folder (I know how to do that) but that is specific to the current document and current folder.

For example, we are working on a case using NewReport, which is inside of MainFolder, and we need to open OldReport that is in SubFolder (of the main folder, which contains NewReport). The cases and folders have an extremely consistent file naming system; they are always named "253762954 OldReport 5/29/2018", or "253762954 NewReport 5/29/2019", with the numbers and dates changing for each specific case.

Is there a way to open a file that contains a keyword? ie., could VBA understand "go to the file path of this active document, go to this sub folder, and open the file in the subfolder that contains, "OldReport", in the file name"?



I just kinda threw together 2 lines that do similar things but not the right thing. I put 'Foldernames' in place of the actual directory and folder names, lol.

Private Sub CheckBox1_Click()
'OldReport
Shell Environ("windir") & "\Explorer.exe " & ActiveDocument.path, vbNormalFocus
Shell "Explorer.exe \\'Foldernames'\OldReport", vbNormalFocus
Me.Hide
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
When i open excel one always the same excel file open(empty XLstart folder) marcin4991 Excel 2 08-29-2016 02:36 AM
Open Folder/File by Keyword How to open Documents folder directly from CTRL+O of Open folder on QAT scvjudy Word 2 08-11-2014 10:58 PM
Open Folder/File by Keyword Formula to open external file with specific program (like open with) pemartins Excel 16 02-24-2014 11:39 PM
Open Folder/File by Keyword excel cannot open the file .xlsx because the file format or file extension is not val teddysika Excel 1 11-22-2012 06:06 AM
Open Folder/File by Keyword Setting file open folder options KevinJ Word 1 10-15-2011 05:51 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:03 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