Results 1 to 6 of 6

Thread: Creating a new WordPad

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Malaysia
    Posts
    1

    Arrow

    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

  2. #2
    Guest
    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?

  3. #3
    Guest
    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]

  4. #4
    Guest
    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.

  5. #5
    Lively Member
    Join Date
    May 1999
    Location
    Singapore
    Posts
    116
    you can use the richtext box control to open .doc and .rtf files
    YC Sim
    Teenage Programmer
    UIN 37903254



  6. #6
    Guest
    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
  •  



Click Here to Expand Forum to Full Width