I am unable to save the contents of a RTB back to the same file name used to read in the data. Generates a run-time error #75 - "Specified path/filename cannot be accessed or is invalid"
If the name is changed in the ShowSave dialog, then it saves properly, including saving to another existing file.
I know there must be a way to save back to the original filename. I'm presuming that there is a sharing violation causing the problem, but I'm at a loss as how to fix it.
The save code is shown below. txtFileName is a fully qualified valid name used to open the file with rtfTextBox.LoadFile
Any suggestions would be appreciated. Thanks!
--------------------
Private Sub cmdSave_Click()
Dim strTemp As String
strTemp = txtFileName
With dlgCommonDialog
.FileName = strTemp
.Flags = cdlOFNOverwritePrompt + cdlOFNShareAware
.ShowSave
If .CancelError Then
Exit Sub
Else
rtfTextBox.SaveFile .FileName, rtfText
End If
End With
If the name is changed in the ShowSave dialog, then it saves properly, including saving to another existing file.
I know there must be a way to save back to the original filename. I'm presuming that there is a sharing violation causing the problem, but I'm at a loss as how to fix it.
The save code is shown below. txtFileName is a fully qualified valid name used to open the file with rtfTextBox.LoadFile
Any suggestions would be appreciated. Thanks!
--------------------
Private Sub cmdSave_Click()
Dim strTemp As String
strTemp = txtFileName
With dlgCommonDialog
.FileName = strTemp
.Flags = cdlOFNOverwritePrompt + cdlOFNShareAware
.ShowSave
If .CancelError Then
Exit Sub
Else
rtfTextBox.SaveFile .FileName, rtfText
End If
End With