I can code my save mnu to work but how can I code a Save As?
I appreciate any help you have to offer,
Daniel Christie
Printable View
I can code my save mnu to work but how can I code a Save As?
I appreciate any help you have to offer,
Daniel Christie
Open a common dialogue save box.
Regards
Chris
If you want to save a Rich Text Box as Rich Text File I found some code here (credits to Matthew Gates):
You can replace "C:\MyFile.rtf" or .txt in a string variable that was previously saved by a Save dialog.Code:'AS RTF
'Save
RichTextBox1.SaveFile "C:\MyFile.rtf",
'Load
RichTextBox1.LoadFile "C:\MyFile.rtf",
AS TXT
'Save
RichTextBox1.SaveFile "C:\MyFile.txt",
'Load
RichTextBox1.LoadFile "C:\MyFile.rtf",
Good Luck
To code save as, do as chrisa_uk suggested. Here is how to do that:
Code:Private Sub mnuSave_Click()
Dim iFile As Integer
On Error GoTo User_Cancelled
With CommonDialog1
.CancelError = True
.DialogTitle = "Save a Text File.."
.Filter = "Txt files (*.txt)|*.txt"
.ShowSave
iFile = FreeFile
Open .filename For Output As iFile
Print #1, Text1.text
Close iFile
End With
User_Cancelled:
End Sub