Example

This example uses the SettingsFile property to return the full path name of the current settings file, then trims the file name portion from the rest of the path. Note: The complete path is returned only if the file was saved using the Reflection Save As dialog box, or the SaveSettings method was called using complete path information for the file name.

Sub TrimSettingsFileName ()

Dim fullPath as String 'Settings file with full path

Dim nameOnly as String 'File name portion of fullPath

Dim lastSlash as Integer 'Postion of the last backslash

Dim position as Integer 'Location marker in fullPath

 

'Use SettingsFile to return the complete path of the current file

fullPath = Session.SettingsFile

 

'Find the position of the last backslash

For position = 1 To Len(fullPath)

If Mid$(fullPath, position, 1) = "\" Then lastSlash = position

Next position

 

'Trim the part of the string after the last backslash and display it

nameOnly = Mid$(fullPath, lastSlash+1)

MsgBox "The current settings file is " + nameOnly

End Sub