Hi, I'm new in VB and my lecturer asked us to create a prototype of an improved program.
Question : How do we get the .doc file filter in wordpad to be integrated in our project? Thanks
Printable View
Hi, I'm new in VB and my lecturer asked us to create a prototype of an improved program.
Question : How do we get the .doc file filter in wordpad to be integrated in our project? Thanks
Is that what you want to do?Code:Open "C:\document1.doc" For Output As #1
Print #1, text1
Close #1
What's a lecturer? Teacher? You in a class or something?
You can use code similar to the one below, but you will need the Microsoft Common Dialog Control added to the form first:
Mat, I think he wanted a filter.
Hopes this helps,Code:Private Sub Command1_Click()
CommonDialog1.Filter = "Documents (DOC files)|*.DOC"
On Error Resume Next
CommonDialog1.CancelError = True
CommonDialog1.ShowOpen
If Err.Number = cdlCancel Then Exit Sub
'the name of the selected file will be in CommonDialog1.Filename
MsgBox CommonDialog1.FileName
End Sub
Sunny
[Edited by sunnyl on 07-15-2000 at 09:50 PM]
Hope that's better explanation and hope it helps.Code:Private Sub mnusave_click()
On Error Resume Next
CommonDialog1.CancelError = True
If Err.Number = cdlCancel Then Exit Sub
CommonDialog1.DialogTitle = "Filename to Save"
CommonDialog1.Filter = "Documents (*.doc)|*.doc"
CommonDialog1.ShowSave
Open CommonDialog1.FileName For Output As #1
Print #1, Text1
Close #1
End Sub
Private Sub mnuopen_click()
On Error Resume Next
If Err.Number = cdlCancel Then Exit Sub
CommonDialog1.CancelError = True
CommonDialog1.DialogTitle = "Select File To Open"
CommonDialog1.Filter = "Documents (*.doc)|*.doc"
CommonDialog1.ShowOpen
Open CommonDialog1.Filename For Input As #1
Text1.text = Input(LOF(1), #1)
Close #1
End Sub
you can use the richtext box control to open .doc and .rtf files
The methods for using the RichTextBox to open and save are LoadFile and SaveFile
Code:'Load the File
RichTextBox1.LoadFile CommonDialog1.filename, rtfRTF
'Save the file
RichTextBox1.SaveFile CommonDialog1.filename, rtfRTF