可以使用 Inputbox
Private Sub cmdsave_Click()
Dim sFileName As String
sFileName = InputBox("請輸入路徑+檔名", "存檔", "c:\data\hello.txt")
F = FreeFile
Open sFileName For OutPut As #F
Print #F, Text2.Text
Close #F
End Sub
再不然就要使用
CommonDialog
你只要把第一段與第二段修改結合一下就好了
語法:
With CommonDialog1
.DialogTitle = "選擇檔案"
.Filter = "處理清單(*.fnl)|*.fnl"
.ShowSave
If Len(.filename) = 0 Then Exit Sub
F = FreeFile
Open .filename For OutPut As #F
Print #F, Text2.Text
Close #F
End With