SelectionFileName$()

Syntax

SelectionFileName$()

Remarks

Returns the full path and filename of the active document if it has been saved. If the document has not been saved, or if the active window is a macro-editing window, SelectionFileName$() returns the current path followed by a backslash ( \ ) (Windows) or colon (:) (Macintosh).

Example

This example checks to see if the active window is a macro-editing window. If not, the example checks the last character in the text returned by SelectionFileName$(). If the last character is a backslash ( \ ) or colon (:), indicating the document has never been saved, a message is displayed.


a$ = SelectionFileName$()
If SelInfo(27) = -1 Then
    MsgBox "A macro-editing window is active."
    Goto bye
End If
end$ = Right$(a$, 1)
If end$ = "\" Or end$ = ":" Then
    MsgBox "The active document has never been saved."
End If
bye:

See Also

FileName$(), FileNameInfo$(), GetDirectory$()