つらつら Excel VBA

私の備忘録です。

ランダムファイル名(FSO)

'ランダムファイル名を生成(FSO)
Function getRndFileName() As String
    
    'Dim FSO As Object
    'Set FSO = CreateObject("Scripting.FileSystemObject")
    Dim FSO As FileSystemObject
    Set FSO = New FileSystemObject
    
    getRndFileName = FSO.GetTempName
    'getRndFileName = Replace(FSO.GetTempName, ".tmp", "_tmp")
    
    Set FSO = Nothing
    
End Function

拡張子は.tmpになる模様

以上。