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

Shorten Time to Automate MSWord Object

Status
Not open for further replies.

CDavis

Programmer
May 5, 2000
155
US
I've been working on a project which uses automation to create Word Documents. My questions are related to the apparently excessive amount of time that it takes to open the Word session. The following code shows that it is taking longer than 5 seconds to actually create the object.

? seconds()
RELEASE ALL LIKE o*
? seconds()
PUBLIC oWord
? seconds()
oWord = CreateObject("Word.Application")
? seconds()
oWord.Visible = .T.

Questions:
1. Is there a way to shorten that interval.
2. Is there a way to use a progress bar to show the end user that something is still happening. It strikes me that it will not be possible to update the progress bar during the line of code that produces the problem.

Comments and suggestion appreciated.

Thanks in advance.

CDavis
 
CDavis,

There isn't anyway to really shorten the time, though there are some tricks that you can use that will make the user think that the time was shorter.

One way is to open the word application object earlier (say at the start of your project) and leave it invisible until you need it. This however has some potential pitfalls and really is contingent on what your needs are.

The other way is to bring up a progress indication bar (eye candy) as you are looking for. In order to overcome the problem with not being able to have your progress bar running at the same time as the code, create a COM Server exe with a progress bar OLE Public class in it. Then use that, you will have to fake the progress by using a timer or something, since there is no way of knowing how far along the Word Application instantiation is...however you could set it to slowly get to 100% over the course of 5 minutes, and put in code beneath your line oWord.visible = .T. to make the progress bar jump to 100% and then close the progress bar by releasing the COM object.

Another thought is to use a screen with just some avi or animated GIF on it running showing a little scene that will let the user know that something is still happening "Starting Microsoft Word...One Moment Please".

Slighthaze = NULL
craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Slighthaze,

Thanks for your response and I apologize for not continuing this thread in a more timely fashion.

I've been experimenting with a number of different possible solutions and actually came upon your thread 184-601102 from last summer in which you were looking for a solution to a similar situation. You posted some code in which you created an out-of-process Automation server. I played around with your code just briefly today and it looks promising. The section of the form that I assume is supposed to be showing some animation doesn't appear to be doing anything -- maybe the link is no longer valid. I'm interested in working with the concept some more -- do you have any suggestions for where I might download an automated gif to play with and how I would reference it in place of your current code.

If anyone else wants to comment, please chime in as well.

Thanks in advance.

CDavis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top