VB代码,求助高手帮助修改以下代码,怎么把保存路径改其他?
下面代码中的保存路径是D盘,我想保存的时候打开路径为我的电脑,由用户自行选择C盘或D,E,F盘等等PrivateSubCommand1_Click()CommonDial...
下面代码中的保存路径是D盘,我想保存的时候打开路径为我的电脑,由用户自行选择C盘或D,E,F盘等等
Private Sub Command1_Click()
CommonDialog1.FileName = "未命名.txt"
CommonDialog1.Filter = "文本文件(*.txt)|*.txt"
CommonDialog1.InitDir = "D:\"
CommonDialog1.ShowSave
On Error GoTo line1
Open CommonDialog1.FileName For Input As #1
Close #1
If MsgBox("是否替换原来的文本", "1") = vbOK Then
line1: Open CommonDialog1.FileName For Output As #1
Print #1, Text1.Text
Close #1
End If
End Sub 展开
Private Sub Command1_Click()
CommonDialog1.FileName = "未命名.txt"
CommonDialog1.Filter = "文本文件(*.txt)|*.txt"
CommonDialog1.InitDir = "D:\"
CommonDialog1.ShowSave
On Error GoTo line1
Open CommonDialog1.FileName For Input As #1
Close #1
If MsgBox("是否替换原来的文本", "1") = vbOK Then
line1: Open CommonDialog1.FileName For Output As #1
Print #1, Text1.Text
Close #1
End If
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询