Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when calling word function from Access

Status
Not open for further replies.

ZappaDog

Technical User
May 13, 2002
25
US
I am trying to write a function that will open a file based on its application name, which is stored in a table.

This one works fine:
Function GetExcelPath()
MsgBox Excel.Application.Path
End Function

but when I run this one, I get "Run-time error '429' ActiveX component can't create object"
Function GetWordPath()
MsgBox Word.Application.Path
End Function

I do have references set to microsoft Word 8.0 library, so I don't know what the problem is.
 
Word is presumedly an object. Are you setting your references properly?

dim objWord as Word.Application
set objWord = New Word.Application

debug.print objWord.Application.Path

 
I do have my references set right, and your code works fine. I was hoping to be able to get the information without actually creating an instance of word. What I don't understand is why it works with excel, but not word.
 
Zappa,

That is odd. I didn't believe it until I tested it. My first thought is that you had probably set a global excel object somewhere in your code. Until I tested each method... using word and excel... and the excel function worked, and the word function didn't... and I KNOW that I don't have any excel references anywhere in my code.

Who knows?
 
At least now I know it's not just me. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top