Late binding trouble

G

Guest

Hello
i have an application that use automation to open word using a specified-personalized word template, filling it with osme data trough Word bookmarks. Anythign was fine until i decided to move from early binding to late bindign because i'm working on upgrading this application and i haven't word2000 (i have XP) while my clinet has. So i rcan reference on my machine only word 10.0 library, while my client needs word 9.0. To solve this issue i decided to try late binding
The problem is that runnning the code below give me an error (#429) saying" Activex component can't create the object
Any suggestion

thanks
rocc

here is the code i have used:______________________
Dim objword As Objec
Set objword = CreateObject(" Word.document"
With objwor
.Visible = Fals
.Documents.Add ("\\server\dati\preventivi\preventivo.dot"
.Visible = Tru
End With
 
P

Paul Overway

You have a space before Word.Document. Also, I think you'll need to
instantiate the Word.Application object....then set your document.

--
Paul Overway
Logico Solutions, LLC
www.logico-solutions.com


Rocco said:
Hello,
i have an application that use automation to open word using a
specified-personalized word template, filling it with osme data trough Word
bookmarks. Anythign was fine until i decided to move from early binding to
late bindign because i'm working on upgrading this application and i haven't
word2000 (i have XP) while my clinet has. So i rcan reference on my machine
only word 10.0 library, while my client needs word 9.0. To solve this issue
i decided to try late binding.
The problem is that runnning the code below give me an error (#429)
saying" Activex component can't create the object"
 
H

Heiko

Hello,
if this really is the code you're using than
type "Word.Document" instead of " Word.document"
in other Words no blanks in front.

Heiko
 
G

Guest

Thanks...
there's some improvement...now the code stop at the first line of this code:

..Visible = False
..Documents.Add ("\\server\dati\preventivi\preventivo.dot")
..Visible = True
sayinf: "object doesn't support this property or method.
i was supposed to code trough late binding exactly the same as in early binding (exepct for the line of code with declarations).

thanks for futher suggestions
 
T

Tim Ferguson

now the code stop at the first line of this code:

.Visible = False

the With object is an active document, and so it cannot be hidden. Try
hiding the Application object.

Tim F
 
G

Guest

Thanks
i have tried also making the lina as comment, just to see if next code will run properly...nope.
It stop on the next line
Documents.Add ("\\server\dati\preventivi\preventivo.dot"
with the same error message..
i'm going crazy..
 
H

Heiko

Use Word.Application:

Dim strDok As String
Dim objword As Object
strDok = "\\server\dati\preventivi\preventivo.dot"
Set objword = CreateObject("Word.Application")
With objword
.Visible = False
.Documents.Add strDok
.Visible = True
End With

Heiko
 
T

Tim Ferguson

Documents.Add ("\\server\dati\preventivi\preventivo.dot")
with the same error message...
i'm going crazy...

As Heiko says, this is a method of the Application object, not the
Document.


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top