'ファイル名から拡張子を除く
Function GetFileNameOnly(sfina As String) As String
Dim i As Integer
Dim nlen As Integer
Dim s1 As String
Dim s2 As String
On Error GoTo Errsub
s2 = ""
For i = 1 To Len(sfina)
s1 = Mid$(sfina, i, 1)
If s1 <> "." Then
s2 = s2 + s1
Else
Exit For
End If
Next
GetFileNameOnly = s2
Exit Function
Errsub:
GetFileNameOnly = ""
End Function
'Accessフォーム コマンドボタン クリックイベント
Private Sub コマンド0_Click()
Me!コマンド0.Caption = GetFileNameOnly("C:\MyAccess\access.mdb")
End Sub