Results 1 to 8 of 8

Thread: word in VB6

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    17

    Post

    I try to open a word document to make changes but it gives error message:
    Run-time error '429'
    ActiveX component can't create object


    my test code is as following:

    Option Explicit
    Dim AppWord As Word.Application
    Dim AppDoc As Word.Document

    Private Sub Form_Load()
    Set AppWord = New Word.Application
    Set AppDoc = AppWord.Documents.Add(App.Path & "test.doc")
    Print AppWord.Name
    End Sub

    any idea? thanks.

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    It looks like you are missing the backslash in the path. Try

    Set AppDoc = AppWord.Documents.Add(App.Path & \test.doc")

    ------------------
    Marty
    What did the fish say when it hit the concrete wall?
    > > > > > "Dam!"

    [This message has been edited by MartinLiss (edited 02-13-2000).]

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    17

    Post

    yes, the missing slash is one of the mistakes. but the real problem is coming from:
    Set AppWord = New Word.Application
    this is where the error message from and the compiler gets stuck in here.

    should that be a problem that I am using WIndows NT to develop my app?

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    No, I use NT and have an app that writes to Word and I have no problems. In your post it looks like you have AppWord defined in the form that uses it. If that's not the case, move the Dim (and it probably should be "Public") there.

    ------------------
    Marty
    What did the fish say when it hit the concrete wall?
    > > > > > "Dam!"

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    17

    Post

    I changed back to 'public' but still doesn't work...
    i am sure i have the 'Microsoft Word 8.0 Object library' in the 'References'

    P.S. the app is using 'Standard.Exe' to develop.

    thanks

  6. #6
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232

    Post

    you're not using the right syntax, it should be:

    set AppDoc = CreateObject(, "Word.Application")

    this should do the job (please let me know if it does...)

  7. #7
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232

    Post

    well, did it help ?

  8. #8
    Lively Member
    Join Date
    Feb 2000
    Posts
    81

    Post

    go to vb6 click on Projects then on references and make sure microsoft activx data objects library is selected.

    That sounds to me what the problem is try that bet ya it works!!!!!!!
    Chow


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