LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.vb.general.discussion,microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Run time '429' : ActveX component can't create object

My code checks whether Excel app is open by using this line of code:

Set moExcel = GetObject(, "Excel.Application")

If there is an error then my code opens Excel app, waits until Excel window
appears and executes the same line of code
and there is again the same error despite the fact that Excel was already
opened.
That problem is NOT a timing problem (I inserted 30 secs delay to the same
effect).
Interestingly, setting a breakpoint at this line and stepping through it
does not create any error.
On the other hand, when Excel is running prior to running this code there is
NOT any error.
Any help appreciated,
Jack

Public Sub CheckExcelApp()
Set moExcel = Nothing
Set moExcelWS = Nothing
On Error GoTo Open_Excel_App
Set moExcel = GetObject(, "Excel.Application")
Debug.Print "Excel app found!"
Exit Sub

Open_Excel_App:
Debug.Print "Excel app NOT found!"
On Error GoTo 0
rtn = ShellExecute(Me.hwnd, "Open", "excel.exe", vbNullString, App.Path,
vbNormalFocus)
If rtn 32 Then 'no error from ShellExecute
Start = Timer
Do Until FindWindow(vbNullString, "Microsoft Excel") 0
If Timer - Start 10 Then ExcelApp = 1: Exit Sub
Loop
Debug.Print "Excel app opened"
Else
ExcelApp = 1: Exit Sub
End If
'''' DelayTimer (30)
Resume Try_Open_Again
Try_Open_Again:
On Error GoTo Error_again
Set moExcel = GetObject(, "Excel.Application")
Debug.Print "Excel app found!"
Exit Sub
Error_again:
Debug.Print "Excel app again NOT found!"
End Sub



..


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Activex component can't create object Naveen New Users to Excel 1 September 4th 07 02:57 PM
Error 429 ActiveX Component can't create object Mike Hartsough Excel Programming 2 September 26th 06 03:00 PM
error 429: ActiveX component can't create object GerryM Excel Programming 0 October 13th 04 05:53 PM
Runtime error '429': ActiveX component can't create object. HELP!! brazilnut Excel Programming 2 January 30th 04 10:47 PM
activex component can't create object with SAP 6.20 Mark Bigelow Excel Programming 0 July 22nd 03 06:24 PM


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"