从一个文档中读入数据,然后插入到word文档对象中

解决方案 »

  1.   

    Dim wordApp As New Word.Application
    Dim Doc As Word.Document
        Dim Para As Word.Paragraph
        
        wordApp.Visible = True
        
        Set Doc = wordApp.Documents.Add
        Set Para = wordApp.ActiveDocument.Paragraphs.Add
        With Para
            .Range.InsertBefore "这是一个标题"
            .Format.Alignment = wdAlignParagraphCenter
            .Range.Font.Color = wdColorBlue
            .Range.Font.Size = 20
            .Range.Font.Name = "隶书"
            .Range.Font.Italic = True
            .Range.Font.Bold = True
            .Range.Font.Underline = wdUnderlineSingle
        End With
      

  2.   

    楼上的多谢指点,我是想用把一个文件读入到内存,然后插入到word中呀,象C中的fopen,fread()把一个文件读到一个buffer中,然后想办法把它手稿插入到word文档对象中.请批教
      

  3.   

    是不是word文档对象有一个Idatobject对象,可以用它向对象中插入内容,可是我不知道该如何用?
      

  4.   

    word对象有insert方法,可以直接把txt文件插到word文档里
    set wordApp = CreateObject("Word.Application")
    wordApp.Selection.InsertFile "D:\111.txt"