7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command1_Click()
With CommonDialog1
.DialogTitle = "另存为对话框"
.InitDir = "C:/"
.Filter = "文本文件(*.txt)|*.txt|inp文件(*.inp)|*.inp|所有文件(*.*)|*.*"
.FilterIndex = 1
.DefaultExt = "*.Txt"
.Action = 2 '或使用CommondDialog1.ShowSave
FileName = CommonDialog1.FileName
Open .FileName For Output As #1
End With
For i = 1 To Len(Text1)
Print #1, Mid$(Text1, i, 1);
Next i
Close #1
'open ""
End Sub
Private Sub print_Click()
Open "c:\123.txt" For Input As #1
Print #1, "abc"
Print #1, "def"
Close #1
End Sub
dim UserFileName as string
Private Sub Command1_Click()
With CommonDialog1
.DialogTitle = "另存为对话框"
.InitDir = "C:/"
.Filter = "文本文件(*.txt)|*.txt|inp文件(*.inp)|*.inp|所有文件(*.*)|*.*"
.FilterIndex = 1
.DefaultExt = "*.Txt"
.Action = 2 '或使用CommondDialog1.ShowSave
FileName = CommonDialog1.FileName
UserFileName= CommonDialog1.FileName
Open .FileName For Output As #1
End With
For i = 1 To Len(Text1)
Print #1, Mid$(Text1, i, 1);
Next i
Close #1
'open ""
End Sub
Private Sub print_Click()
Open UserFileName For Input As #1
Print #1, "abc"
Print #1, "def"
Close #1
End Sub
Private Sub Command1_Click()
CommonDialog1.Filter = "文本文件(*.txt)|*.txt|inp文件(*.inp)|*.inp|所有文件(*.*)|*.*"
CommonDialog1.ShowOpen
If CommonDialog1.FileName = "" Then Exit Sub
ePath = Left(CommonDialog1.FileName, InStr(1, CommonDialog1.FileName, CommonDialog1.FileTitle) - 1) 'ePath 获取文件的路径
eName = CommonDialog1.FileTitle 'eName 获取文件名字
Text1.Text = CommonDialog1.FileName
End Sub