VBScript Runs Slow Unless User Hits Vertical Scroll?

T

Takuon Soho

This is a variation on a previous post of a few days
ago "VBScript Runs Slow Unless Word Already Open"

I have a VBScript which is called from C++ and builds
a report using Word 2000 on a Windows NT server.

The reports were taking way too long to build, for example 3 minutes
when it should have taken about 30 seconds.

In the C++ code, I changed the invocation of the Script from WScript to
CScript
and that has given some noticeable improvement although it is still
taking a little over a minute.

But most MYSTIFYING of all is that the users report
to me that if they click on the vertical scroll and hold the mouse down,
the report builds in 20 seconds!!

Is this some sort of focus thing?? Should I be setting the focus
to Word from within the VBScript? I did'nt think I had to because
once you say Create Application (or Get Object) Word starts up and has
the focus anyway.

Any ideas on how I can make the VBScript operate at 20 seconds all the time
without the user having to click and hold the mouse button down on the
scroll bar?

Thanks
J
 
W

Word Heretic

G'day "Takuon Soho" <[email protected]>,

A code sample would help enormously here, I'd be looking at holding
instancing mainly.

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Takuon Soho reckoned:
 
T

Takuon Soho

I discovered that by using Set objWord = GetObject(,
"h:\Somedirectory\Document1")
instead of Set objWord = GetObject(,"Word.Application) (see code below)
and by keeping Word minimized to an icon throughout the duration of the
vbscript, I got sufficent speed.

As for the previous message
when I was doing it with Word maximized so that you could
see it operate and why the thing speeds up when you click
on the scroll bar, or click on the "view" menu item
without selecting anything, I don't know and perhaps
should be submitted to Unsolved Mysteries
or some such.

Thanks
Jim

Dim objWord

On Error Resume Next

Set objWord = GetObject(, "Word.Application")

If objWord Is Nothing Then
Set objWord = CreateObject("Word.Application")
End If

objWord.Activate

On Error GoTo 0

objWord.Visible = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top