Function to Find File Name of Page Displayed

Function getFileName()
Dim lsPath, arPath
'Obtain the virtual file path
lsPath = Request.ServerVariables("SCRIPT_NAME")
'Split the path along the /s. This creates a one-dimensional array
arPath = Split(lsPath, "/")
'The last item in the array contains the file name
getFileName = arPath(UBound(arPath,1))
End Function

source

Leave a Reply