Science literacy is being plugged into the forces that power the universe. There is no excuse for thinking that the Sun, which is a million times the size of Earth, orbits Earth.
I may be expecting to achieve too much in my attempt to fully filter a C Drive Explorer Directory for a certain file name. Following are the steps I currently follow which successfully achieves the objective, BUT I am trying to automate Step 4 so no manual interaction in this step Maybe I expecting to do more than possible.. 1)I hit a button on a EXCEL worksheet. 2)My VBA identifies the file name ,without extension (no .docx etc..) Say file name: Bag 3)Opens the main directory that I have designated that it is located in Say C:\A01 Manual interraction 4)I paste the File Name : 'Bag" into the Search section of the Directory C:\A01 Finally 5)In the Explorer Directory: All the Files containing 'Bag' in the File Name are filtered within C:\A01 (and its sub Directories) 6)Lastly, I select the one I want then open it SO, the aim is to hit the button in (Step 1) and immediately all files names containing 'Bag' come up within the Explorer Directory (Step 6) * No manual interaction Step 4
CURRENT CODE FOR OPENNING THE DIRECTORY Sub OpenDIR_DocIndex() Selection.Copy stFolder = "C:\A01\" If Len(Dir(stFolder, vbDirectory)) <> 0 Then Shell "Explorer.exe /n,/e," & stFolder, vbNormalFocus Else MsgBox "The directory does not exist!", vbCritical End If End Sub
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Excel Forum.