VBScript Run Slow Unless Word Already Open??

J

James Pannozzi

I have an elaborate VBScript which
builds a report in Word 2000 running on an NT Server with Citrix.

If the VBScript is started without Word being open,
then the VBScript invokes Word but the script runs very slowly.

If Word is already open, the script runs like a rocket.

Here are the first few lines where it invokes Word -
any ideas on what might be wrong??

Thanks
Jim

Dim objWord

On Error Resume Next

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

If objWord Is Nothing Then
Set objWord = CreateObject("Word.Application") 'When this line
runs, the rest of the script runs real slow.
End If

On Error GoTo 0

objWord.Visible = True
Set objDoc = objWord.Documents.Add("H:\StrucOne\NewPrintMethod1.dot",
,False)
 
M

Malcolm Smith

Is there anything in Word's autoexec which is causing it do something
memory intensive?
 
J

James Pannozzi

Malcolm Smith said:
Is there anything in Word's autoexec which is causing it do something
memory intensive?

Our administrator says:

"It doesn't call anything extra. Also, the CPU usage and memory usage
indicators do not even flinch when Word starts."

Thanks

Jim
 
J

James Pannozzi

I have discovered, after trying several things,
that if, when I invoke the report building VBScript from
the C++ program, I invoke it using WinExec and explicitly call
CScript.exe instead of WScript.exe,
the problem does not seem to occur and the report builds at normal
speed.

Why this should be I don't know but I am changing all
the invocations in the C++ program to do it in the above mentioned
manner.

Thanks
Jim
 

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