做的是一个由doc转成pdf的程序。    
    Set wrd = CreateObject("word.basic")
    wrd.fileopen Text100.Text & "\" & adoc
    wrd.fileprint
    wrd.fileclose
出错代码如上。错误是:activeX无法创建对象。
该怎样改呢?

解决方案 »

  1.   

    Private Sub Command1_Click()
    Dim xApp As Word.Application
    Dim xDoc As Word.Document
    Dim i As Integer, j As Integer
        Screen.MousePointer = vbHourglass
        Set xApp = New Word.Application
        Set xDoc = xApp.Documents.Open("d:\test.doc")
        xDoc.PrintOut
        xDoc.Close
        xApp.Quit
        Set xApp = Nothing
        Set xDoc = Nothing
        Screen.MousePointer = vbDefault
    End Sub
    ==============================Dim Word as Object
    Set Word=CreateObject("Word.Basic")
    word.fileopen c:\xin.doc
    word.fileprint   打印
    word.fileclose   关闭文件
    Word:Set Wordobj =Nothing。
    试一试,如何?