I'm a novice VB programmer using VB5, and I'm trying to add MS Word capability to a basic database program that I've written. I've had some success with automating Excel, and figured that Word would essentially be the same task. However, for some reason, the program doesn't seem to cooperate. I originally wrote the program on a Win 2000 laptop with Office XP (the code is below), and it worked just fine. However, when I tried to use it on a Win XP Home desktop with Office XP (both of which all of our terminals at the office have), the program wouldn't work. Whenever it gets to the code about adding a new document, it crashes, saying that there is an Automation Error. Here is the code that I have been using:
Dim WrdApp As Object
Set WrdApp = CreateObject("Word.Application")
WrdApp.Visible = True
Set WrdApp = Nothing
I've tried several other variations on this simple code, but it always seems to crash at the line where it adds a new document, or also even if I try to open an existing document. There may be something very simple that I'm missing, such as an incorrect reference or missing component...like I said, I am new at this. I have selected the Word 10.0 object library under components, but is there something else that I'm missing? If anyone could please let me know what might cause such an error, I'd definitely appreciate it. Thanks in advance for your help!