Hi clever people
I am a beginnner working in VB5, struggling with open, save, and save as procedures. I have progressed well. They seem to work as I wish, mostly. I use CommonDialog1 and it is nice but a few things puzzles me.
First of all:
I want my procedure to alert with MsgBox that user is saving a filename that already exists, you know the classic windows: "File Already exists, overwrite?"-message.
How do I do that with CommonDialog1. A simplified version of my code is this:
-------
Public Sub SaveAS()
Dim FileNum As Integer
Dim FileName As String
Dim Address As String
txtAddress.Text = Address
FileNum = FreeFile
'open CommonDialog1 in "save as-mode"
CommonDialog1.Action = 2
FileName = CommonDialog1.FileName
Open FileName For Output As FileNum
Write #FileNum, Address
Close FileNum
End Sub
-------
What do I code? and where do I insert the code? Is there a better approach to my needs?
Secondly:
I wonder how do you control/code the Save button and the cancel button of the CommonDialog1?
I am a beginnner working in VB5, struggling with open, save, and save as procedures. I have progressed well. They seem to work as I wish, mostly. I use CommonDialog1 and it is nice but a few things puzzles me.
First of all:
I want my procedure to alert with MsgBox that user is saving a filename that already exists, you know the classic windows: "File Already exists, overwrite?"-message.
How do I do that with CommonDialog1. A simplified version of my code is this:
-------
Public Sub SaveAS()
Dim FileNum As Integer
Dim FileName As String
Dim Address As String
txtAddress.Text = Address
FileNum = FreeFile
'open CommonDialog1 in "save as-mode"
CommonDialog1.Action = 2
FileName = CommonDialog1.FileName
Open FileName For Output As FileNum
Write #FileNum, Address
Close FileNum
End Sub
-------
What do I code? and where do I insert the code? Is there a better approach to my needs?
Secondly:
I wonder how do you control/code the Save button and the cancel button of the CommonDialog1?