Error while accessing Word from VB script
Hi ,
I am a beginner in VB script. I am trying to invoke microsoft word from VB.
But while running the code following error is being displayed.
"Compile error
User-defined type not defined "
My code is as below
Sub Create_Doc()
Dim appWD As New Word.Application
Dim docDoc As New Word.Document
Dim rngRange As Word.Range
' Create a new instance of Word & make it visible
Set appWD = CreateObject("Word.Application.10")
appWD.Visible = True
End sub
Help me in this regard.....
Rajesh
[630 byte] By [
pvrajesh31] at [2007-11-11 7:59:05]

# 2 Re: Error while accessing Word from VB script
All variables are Variants in VBScript. Try this:
Dim appWD, docDoc, rngRange
' Create a new instance of Word & make it visible
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
# 5 Re: Error while accessing Word from VB script
Hi weber,
The error that displayed on the system is as follows
Run time error '429':
"ActiveX component can't create object".
Anything should be included as library ?
# 6 Re: Error while accessing Word from VB script
I just created a new VB project, removed Form1 and added a new Module, and posted the above code into a Sub Main. When I run the app, Word is loaded and becomes visible.