I dont use Excell VBA, dont even have excell, lol so im not sure but you could try something like the following with your code above?
Function GetCurDir()
Dim str As String
Dim pos As Integer
str = ActiveWorkbook.FullName
pos = InStrRev(str, "\")
str = Mid(str, 1, pos)...