如题,谢谢

解决方案 »

  1.   

    Private Sub munopen_Click()
    Dim filestr As String, filen As String
    Dim tempstr As String, dotpos As Integer
    Dim saveit As Integer
    If modified = True Then
    saveit = MsgBox("文件" & Me.Caption & "的正文已更改," & "是否保存更改?", vbYesNoCancel)
    If saveit = 2 Then Exit Sub
     If saveit = 6 Then
     If fpath_name <> "" Then CommonDialog1.FileName = fpath_name
     CommonDialog1.Filter = "text files(*.text)|*.txt|" & "all files(*.*)|*.*"
     frmmain.CommonDialog1.Flags = &H4
    frmmain.CommonDialog1.ShowSave
    If CommonDialog1.FileName <> "" Then
    Open frmmain.CommonDialog1.FileName For Output As #1
    Print #1, Me.Text1.Text
    Close #1
    End If
    End If
    End IfCommonDialog1.Filter = "text files(*.text)|*.txt|" & "all files(*.*)|*.*"
    CommonDialog1.Flags = &H4
    CommonDialog1.ShowOpen
    If CommonDialog1.FileName = "" Then Exit Sub
    fpath_name = CommonDialog1.FileName
    Open CommonDialog1.FileName For Input As #1
    filestr = ""
    Do Until EOF(1)
    Line Input #1, tempstr
    filestr = filestr & tempstr
    Loop
    Close #1
    Me.Caption = CommonDialog1.FileTitle
    Text1.Text = filestr
    opencanceled:
    End Sub
    用此方法打开,然后选择ALL.FILES这种类型读取
      

  2.   

    不用那么麻烦的,用下面的就可以解决。Dim WithEvents objApp As Word.Application
    Dim yourValue as String '定义要取的值Set props = objApp.ActiveDocument.CustomDocumentProperties
    '其中YOURVALUE就时自定义里面的属性
    yourValue = props("YOURVALUE").Value