|
-
Jul 15th, 2000, 08:40 PM
#1
Thread Starter
New Member
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
-
Jul 15th, 2000, 08:47 PM
#2
Code:
Open "C:\document1.doc" For Output As #1
Print #1, text1
Close #1
Is that what you want to do?
What's a lecturer? Teacher? You in a class or something?
-
Jul 15th, 2000, 08:47 PM
#3
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.
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
Hopes this helps,
Sunny
[Edited by sunnyl on 07-15-2000 at 09:50 PM]
-
Jul 15th, 2000, 09:03 PM
#4
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
Hope that's better explanation and hope it helps.
-
Jul 15th, 2000, 09:23 PM
#5
Lively Member
you can use the richtext box control to open .doc and .rtf files
YC Sim
Teenage Programmer
UIN 37903254
-
Jul 16th, 2000, 10:00 AM
#6
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|