473,396 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

CreateObject times out?

Hi,

I am having some problems with CreateObject and Powerpoint. I'm working
from VB.NET with Powerpoint 2003.

The code below is only ever called when powerpoint is already open.
It's called when the user excecutes an action on a smart tag.

Almost always, GetObject fails, which causes CreateObject to be called.
At that point, PPT locks (can't do anything but move mouse) for ~30
seconds, before two message boxes pop up. The order is always the same
and is clearly important. The first is from my catch block ("Create
Error: Cannot create ActiveX component"), and the second box immediately
follows, reading "Powerpoint can't be used as a server because a dialog
box is open. Please close open dialog boxes to continue."

If the action is called again, GetObject is always successful. Very
occasionally (5% of the time?) GetObject succeeds the first time it is
called and I don't have the problem.

I have discovered that if I include a second CreateObject call in the
final catch block (after my msgbox), it will succeed. However, the
30-second wait for the first one to time out is not really acceptable
from a performance standpoint, so I need to find a way to prevent that
from happening in the first place!

What is happening, and how can I fix it? I appreciate any insight you have.

Thanks!

-Casey

Try

Try
'try to use GetObject
pptApp = DirectCast(GetObject(, "Powerpoint.Application"),
PowerPoint.Application)
MsgBox("it worked!")
Catch newEx As Exception
MsgBox("Get Error: " & vbCrLf & newEx.Message)
'if GetObject fails, try CreateObject
pptApp = DirectCast(CreateObject("Powerpoint.Application", ""),
PowerPoint.Application)
End Try

Catch ex As Exception
MsgBox("Create Error:" & vbCrLf & ex.Message)
End Try

'do stuff with pptApp here
Nov 21 '05 #1
2 2274
Casey,
I've run into this before and never did find a way to solve it.

But I did find a workaround that works everytime.

The first failure creates a trappable error so I throw in an On Error
goto errHandler line just before the error creating line.

In errHandler I have a Case Select routine for the various error
values. In this error value I have a counter from 1 to 4 set to Resume
at the CreateObject line and rerun it. I set the counter to 4 so that
if I get there I can get out of the loop, even if it is unsuccessful,
I'm out and can try to deal with it another way.

Oddly enough, and I can't explain this, I've never had the counter
ever hit 3. The CreateObject line always worked on the second try.

I originally encountered this in Office 97 and still use the same
simple routine in everything I still do and haven't taken it out for
testing since so I don't know if it was Office 97 specific or just
some funky PPT thing.

Brian Reilly, PowerPoint MVP
Nov 21 '05 #2
Thanks for your input, Brian. It's good to hear at least that someone
else has encountered the same thing. I still haven't found the silver
bullet solution either. I guess that's why we invent workarounds...

Thanks!

-Casey

Brian Reilly, MS MVP wrote:
Casey,
I've run into this before and never did find a way to solve it.

But I did find a workaround that works everytime.

The first failure creates a trappable error so I throw in an On Error
goto errHandler line just before the error creating line.

In errHandler I have a Case Select routine for the various error
values. In this error value I have a counter from 1 to 4 set to Resume
at the CreateObject line and rerun it. I set the counter to 4 so that
if I get there I can get out of the loop, even if it is unsuccessful,
I'm out and can try to deal with it another way.

Oddly enough, and I can't explain this, I've never had the counter
ever hit 3. The CreateObject line always worked on the second try.

I originally encountered this in Office 97 and still use the same
simple routine in everything I still do and haven't taken it out for
testing since so I don't know if it was Office 97 specific or just
some funky PPT thing.

Brian Reilly, PowerPoint MVP

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Peter Koller | last post by:
Hi group! I am getting the following error from my ASP application: Microsoft VBScript runtime error '800a0007' Out of memory: 'Server.CreateObject' It always (as far as i have...
14
by: wk6pack | last post by:
Hi, I'm getting this error on my asp page intermittently. One day it is fine, another day, it crashes a lot. I have searched the web and microsoft on this and they say it is a recordset...
9
by: CJM | last post by:
I've built an application in VB6 does some processing - it's not really important what it does... The application consists of a single DLL which does all the hard work, and a simple EXE which...
6
by: MacKenzie | last post by:
The statement in an asp page: dim objShell Set objShell = WScript.CreateObject("WScript.Shell") now gives this error: VB err= 424,Object required If I use...
1
by: Raúl Martín | last post by:
I´ve a function in asp that run correctly but If I tried to change it forasp.net in asp: xmlHTTP = CreateObject("Microsoft.XMLHTTP") And I thought to use this sentence for asp.net but the...
12
by: karen | last post by:
Hi all : this is going to be a long post. So i apologize in advance :) i am converting a java program in VB right now. I am a java programmer by trade. so i am no expert in this department. I...
9
by: Terry | last post by:
Based on the documentation that I have found on this subject, I am trying to use ‘Activator.CreateInstance(string, string)’ for a replacement for CreateObject, but I don’t seem to be able to...
1
by: Lynn Zou | last post by:
In our system , we use an ASP page to upload files but sometimes it doesnot work as it suppose to do and we found error log in Application Error as: Event Type: Error Event Source: Active...
3
by: Sagar | last post by:
I am working on a project where Server.CreateObject is replaced with CreateObject all over the project. Though I know that this will improve performance in terms of Memory overlhead because of how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.