Results 1 to 2 of 2

Thread: Microsoft Word Object 8.0

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philadelphia
    Posts
    47

    Question

    I am trying to open word in windows 2000 vb enterprise edition, i added the ref and the lines
    In Declarations :
    Option Explicit
    Dim ObjWord as Word.Application
    And in Code:
    Set objWord = New Word.Application 'the error

    Everytime it hits the Set line, i get a ActiveX error, "Cant create object", however, word loads in the process window? Whats wrong here?.. I tried rewriting the code in many other forms, such as Set Obj = CreateObject("Word.Application")
    and Word.Application.9, however, none of these sollutions are helping the problem.

  2. #2
    Addicted Member jeroenh's Avatar
    Join Date
    Aug 2000
    Location
    Rotterdam, Holland
    Posts
    201
    When I want to start Word form a subroutine or function I use the following code:

    Code:
    Public Sub ProcedureName()
    Dim objWord as New Word.Application
    End Sub
    With this code a word session is started form one line instead of two. Now you can use objWord to control Word. Do not forget to use the command
    Code:
    objWord.Visible=true
    in order to make it visible to the user.
    Catch you later,

    Jeroen Hoekemeijer
    Code:
    If 1 = 2 Then MajorError

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