Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem saving rich text box data to file from which it was opened

Status
Not open for further replies.

szamkow

Technical User
Sep 14, 2001
22
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top