Function File Names Class

CombinePrefixAndExtension

Combine the prefix and extension portions of a file name. In the file name "WIN.INI", "WIN" if the prefix and "INI" is the extension.

Signature (Visual Basic / VBA)

Public Function CombinePrefixAndExtension( _
      ByVal vPrefix As Variant _
    , ByVal vExtension As Variant _
    ) As Variant

Code Example

    CombinePrefixAndExtension("",     "")     = ""
    CombinePrefixAndExtension("",     "INI")  = ".INI"
    CombinePrefixAndExtension("",     ".INI") = ".INI"
    CombinePrefixAndExtension("WIN",  "")     = "WIN"
    CombinePrefixAndExtension("WIN",  "INI")  = "WIN.INI"
    CombinePrefixAndExtension("WIN",  ".INI") = "WIN.INI"
    CombinePrefixAndExtension("WIN.", "")     = "WIN"
    CombinePrefixAndExtension("WIN.", "INI")  = "WIN.INI"
    CombinePrefixAndExtension("WIN.", ".INI") = "WIN.INI"

Parameters

Parameter Description
vPrefix The prefix portion of the file name--everything to the left of the extension (if any extension). Function returns Null if vPrefix is Null or cannot be fixed-up to a string.
vExtension The extension portion of the file name--the trailing string past the last period (.) that usually specifies the type of data in the file or the application associated with the data in the file. Function returns Null if vExtension is Null or cannot be fixed-up to a string.