就是在VB调用WORD并且可以在WORD中创建ACTIVEBAR的来自己定义相关的文件操作!

解决方案 »

  1.   

    给你一小段操纵Word的例子
    'Create an empty class to reference the Word Object
    Dim w1 As Word.ApplicationPrivate Sub cmdAddDocument_Click()
        'Create a new document
        w1.Documents.Add
    End SubPrivate Sub cmdAddText_Click()
        'Test to see if there is a document open
        If w1.Documents.Count < 1 Then
            MsgBox "No documents open"
            Exit Sub
        End If
        
        'Set the font size
        w1.Selection.Font.Size = txtSize.Text
        
        'Set the font weight etc.
        w1.Selection.Font.Bold = IIf(chkBold.Value = 1, True, False)
        w1.Selection.Font.Italic = IIf(chkItalic.Value = 1, True, False)
        w1.Selection.Font.Underline = IIf(chkUnderline.Value = 1, True, False)
        
        'Set the alignment
        w1.Selection.ParagraphFormat.Alignment = drpJustification.ListIndex
        
        'Type the text
        w1.Selection.TypeText txtTypeText.Text
    End SubPrivate Sub cmdPrint_Click()
        'Print out
        w1.ActiveDocument.PrintOut
    End SubPrivate Sub Form_Load()
        'Create a new instance of word
        Set w1 = New Word.Application
        'Initialize Word as visible
        Option1_Click 0
        'Make the default value the first in the list
        drpJustification.Text = drpJustification.List(0)
    End SubPrivate Sub Form_Terminate()
        'Close the Word application (not saving changes)
        w1.Quit False
        Set w1 = Nothing
    End SubPrivate Sub Option1_Click(Index As Integer)
        'Make word invisible / visible
        w1.Visible = IIf(Index = 0, True, False)
    End Sub
      

  2.   

    w1.Quit False
    Set w1 = Nothing