![]() |
#1
|
|||
|
|||
![]()
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 |
|
![]() |
||||
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 |
![]() |
scvjudy | Word | 2 | 08-11-2014 10:58 PM |
![]() |
pemartins | Excel | 16 | 02-24-2014 11:39 PM |
![]() |
teddysika | Excel | 1 | 11-22-2012 06:06 AM |
![]() |
KevinJ | Word | 1 | 10-15-2011 05:51 AM |