Link to home
Start Free TrialLog in
Avatar of Alfredo Luis Torres Serrano
Alfredo Luis Torres SerranoFlag for United States of America

asked on

Word and DAO

Hi experts

   I have a problem trying to create a new document object for word processing, there is one object called document in DAO 2.5/3.5 Library and i receive the error "The use of NEW clause is invalid"

  How can i solve this?

 thanks
Avatar of peterwest
peterwest

As far as i'm aware you don't use DAO for creating word documents - this is for creating links to databases such as MS Access.

To create a new document through code you need to include a reference to the Microsoft Word Object Library - the precise version you'll use depends on what version of Office/Word you have.   On mine it's version 9 (Office 2000).

You can then create the document by going:

Dim objWordApp As New Word.Application
Dim objNewDocument As Document

Set objNewDocument = objWordApp.Documents.Add

You can then manipulate the document using the objNewDocument object that has been defined.

Hope this helps.

Pete
Avatar of Alfredo Luis Torres Serrano

ASKER

I know i have a reference to word 8 library

 The problem is that in the word 8 library the object document have the same name that a object document in DAO library and i need to use both.

 The problem still been that there is a conflict (I Think) with the document object in DAO libary with the document object (same name) in word 8 library.

Thanks

ASKER CERTIFIED SOLUTION
Avatar of peterwest
peterwest

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks that is logical