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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX problem in Visual Basic 6.0

Status
Not open for further replies.

LAbluesman

Programmer
Jan 14, 2002
10
0
0
US
here's the deal :

we're developing a Visual Basic 6.0 application that uses MS Word 2000 and Excel 2000 in the background. This is not the problem. the application was working just fine about a week ago (microsoft app working just fine???, oh my god!!!). a week ago we saved everything from the machine, formatted everything, and reinstalled Win2000 (we had win2000 on before the format/install). This is just part of our annual "clean up all the junk that's probably accumilated over the year in windows".

now, the problem is this: now whenever I run the application, and the appl. creates an instance of Word, it craps out. we get the following error message:
Run-time error '429': ActiveX component can't create object.

to note, we have Visual Studio 6.0 with the MSDN Library and ServicePac 5 installed. also, MS Office with SR1 and SP2 installed.

below is the code where the crash occurs:
'----------------------------------------------------------------------------------------------------------
Option Explicit
Dim appWord As Word.Application 'instance of MSWord object.
Dim appExcel As Excel.Application 'instance of MSExcel object.
...

Private Sub MDIForm_Load()
Set appWord = CreateObject(&quot;Word.Application&quot;) <-------ERROR OCCURS HERE!!!!!!!!!!!!!!!
appWord.WindowState = wdWindowStateMinimize 'Window comes up minimized.
appWord.ScreenUpdating = False 'User won't see work being done.
appWord.Visible = False 'Window can't seen by user.

Set appExcel = CreateObject(&quot;Excel.Application&quot;)
appExcel.WindowState = xlMinimized
appExcel.ScreenUpdating = False
appExcel.Visible = False

frm_brcsMaster.Visible = True

Load frm_login
End Sub
'----------------------------------------------------------------------------------------------------------
any suggestions would be appreciated, as this unholy thing is really starting to chap my @$$.

thanks.
 
Seems like Word's not properly registered on the machine.
Greetings,
Rick
 
Well, MS Office is on the machine, with the SR1 and SP2 patches applied.

so, lets assume you're right. how would I go about checking to see if Word ~is~ correctly registered?, and then, if it is not, how to register it.

an additional note : We've uninstalled and reinstalled Visual Studio 6.0 and MS Office 2000 multiple times since this problem has started occuring, thinking that perhaps we did something different than usual in the installation process. It hasn't seemed to help.

thank you :)
 
Can you get a reference to the library of Word in your project references? It should be there, if it's registered.

Did you check the event log? Maybe there's some more info in there....
Greetings,
Rick
 
ok, I've come up with a round-about solution to this lil' turd of a problem.

here was the code causing the trouble:
Private Sub MDIForm_Load()
Set appWord = CreateObject(&quot;Word.Application&quot;) <-------ERROR OCCURS HERE!!!!!
appWord.WindowState = wdWindowStateMinimize
appWord.ScreenUpdating = False
appWord.Visible = False

here is what the code looks like now:
On Error Resume Next
Set appWord = GetObject(&quot;C:\Documents and Settings\Administrator\My Documents\Xdummy.doc&quot;) <--- :)

' Set appWord = CreateObject(&quot;Word.Application&quot;)
appWord.WindowState = wdWindowStateMinimize
appWord.ScreenUpdating = False
appWord.Visible = False

basically, it calls for replacing the call to CreateObject() with a call to GetObject(). About the only diff is that you might want to close out the &quot;Xdummy.doc&quot; Word file, since it's only use was to give GetObject() something to open.

Now, if anyone has a solution to actually get CreateObject() working properly, ~please~ post that lil' gem here so that others (and me ;) can have it for later.
 
Double check your project references and make sure you have OLE Automation(stdole2.tlb) and Microsoft Word 8.0 Object Library(msWord8.olb) checked off. If they already are, rebuild your project form a clean vbp. The addresses referenced in your .vbp for these two libraries may be different on your new machine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top