I have a Summary workbook the pulls data from new workers' logs via a macro called "Updateme"
Currently, I need to update the "Updateme" macro in the summary work book for each hire group with the path to the directory where their training logs are located.
I will be promoting out of my current position and will be handing the duty of maintaining these logs off to a co-worker.
I want to code the updater so that the path to the logs does not need to be hard coded, but is variable as each hire group gets its own folder. My initial thought was to code a field in List.xlsx with the path listed for each worker, but then I realized that the path to List.xlsx is what I need to make indeterminate!
I had the idea to use "Application.GetOpenFilename("*.xlsx") but I don't want the user to have to find the list.xlsx file every time.
Is it possible to have the macro pull the directory from "Application.GetOpenFilename("*.xlsx") using something like:
Dim sFullName As String
Dim sFileName As String
sFullName = Application.GetOpenFilename("*.txt,*.txt")
sFileName = Dir(sFullName)
and then have the macro write the directory or path in the macro for the future, once the path is known?
Any ideas on how to do this?
The relevant part of my existing macro is below.
WorkbookPath = "T:\Eligibility Support\EA_FAD\EA_FAD_Teams\Induction Team\Case Review Documents\04.2016 Hire Group\Case Review Logs\"
myRealWkbkName = WorkbookPath & "List.xlsx"
' Open List.xlsx and retrieve reference workbook names and passwords
Workbooks.Open myRealWkbkName, UpdateLinks:=False, Password:="Mark"
Set PWWorkbook = ActiveWorkbook
' Populate wkbName() and wkbPass() arrays from List.xlsx
ReDim myFileNames(1 To LastRowA1) As String
ReDim myPasswords(1 To LastRowA1) As String
For i = 1 To LastRowA1
myFileNames(i) = PWWorkbook.Sheets(1).Cells(i, 1).Value
myPasswords(i) = PWWorkbook.Sheets(1).Cells(i, 2).Value
Next i
PWWorkbook.Close False
' Open Password Protected Workbooks and close workbook
For i = 1 To LastRowA1
Workbooks.Open WorkbookPath & myFileNames(i), UpdateLinks:=False, Password:=myPasswords(i)
Workbooks(myFileNames(i)).Close SaveChanges:=False
Counter = Counter + 1
pctDone = Counter / Hires ' Progress Bar
Call Updateprogress(pctDone) ' Progress Bar
Next i
Thanks for any help or ideas!
Bookmarks