Option Explicit ' 文字長を指定して、乱数で適当な文字列を作成します Function get_unique_name(length As Integer) As String Dim offset As Integer Dim base As Integer base = Asc("a") Dim result As String result = "" ' 指定された文字列分だけ連結 Dim i As Integer Dim r As Double Dim c As String For i = 0 To length - 1 r = Rnd() offset = Round(r * 100, 0) Mod 26 c = String(1, base + offset) result = result & c Next i get_unique_name = result End Function