My searching has got me close, but not quite there. Most answers to my searches will loop thru ALL files in a folder. I only want to open certain files. **
One approach I'm trying is to extract the path and list of filenames from the folder. (Note - I am not dealing with subfolders... thankfully!)
I have the extraction working. My worksheet has the path in cell A1. The list of filenames starts at A2 and goes down the column. I can manually edit this list to remove unwanted files.
A1 - https:/ /mycomp.sharepoint.com/Shared Docs/Dept/Project/Customer/Est Rev 2/ (just an example... purposely did / /)
A2 - 1234 - Pump.xlsm
A3 - 1234 - Fan.xlsm
A4 - 1234 - Base.xlsm
A5 - SU1234 - Support
etc
Here is some simple code I'm working on.
It works if FILENAME01 is just a single cell (single file). I'm trying to get this to work with a list of files.
** As I said at the top, I'm trying to work with just certain files. When we were still on our own servers, I had this all working without extracting a list (using Dir). The filenames of interest always have the same number in them ("1234", but not always at the start) and are Excel files. I filtered for this directly in the code. Now I'm having to learn the ins and outs of SharePoint and I'm struggling.
Thanks.
One approach I'm trying is to extract the path and list of filenames from the folder. (Note - I am not dealing with subfolders... thankfully!)
I have the extraction working. My worksheet has the path in cell A1. The list of filenames starts at A2 and goes down the column. I can manually edit this list to remove unwanted files.
A1 - https:/ /mycomp.sharepoint.com/Shared Docs/Dept/Project/Customer/Est Rev 2/ (just an example... purposely did / /)
A2 - 1234 - Pump.xlsm
A3 - 1234 - Fan.xlsm
A4 - 1234 - Base.xlsm
A5 - SU1234 - Support
etc
Here is some simple code I'm working on.
VBA Code:
Sub WBOpenTest1()
Dim strPath As String, strPrj As String, strFilename As String
Dim wbkCurr As Workbook
strPath = Range("PATH_FOLDER") 'path to the folder of interest - cell A1
strFilename = Range("FILENAME01") 'Single cell ok (eg A2). Range (A2:A5) doesn't work. Array?
Workbooks.Open Filename:=(strPath & strFilename) 'Want to loop thru list of files and update them. Inside a loop.
End Sub
It works if FILENAME01 is just a single cell (single file). I'm trying to get this to work with a list of files.
** As I said at the top, I'm trying to work with just certain files. When we were still on our own servers, I had this all working without extracting a list (using Dir). The filenames of interest always have the same number in them ("1234", but not always at the start) and are Excel files. I filtered for this directly in the code. Now I'm having to learn the ins and outs of SharePoint and I'm struggling.
Thanks.