Re: "pool" a tightly controlled set of Excel instances
- From: mr_unreliable <kindlyReplyToNewsgroup@xxxxxxxxxxx>
- Date: Thu, 04 Jan 2007 13:14:19 -0500
Brian, microsoft has acknowledged the problem, and provided
a solution, but you are not going to like it.
http://support.microsoft.com/kb/147573
The solution is to send-a-message (WM_USER + 18) to the XL
window, to get it to register itself in the ROT (running
object table).
The problem is that scripting ain't got no capability to
"send messages", i.e., to call the "SendMessage" api. If
microsoft wanted you to be able to call api's from script,
then they would have provided that capability.
So, if you really want the solution, you are going to have
to resort to something that is ugly. Either write yourself
an actX object to call the api, or use somebody else's actX
object to do the job. If you are amenable to the second
possibility, I suggest using DynaWrap, which will allow
you to call api's from script.
Otherwise, switch to some other scripting language (for
example AutoIt3 or FBSL) which have api capabilities built
into the language.
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)
--- <DynaWrap Boilerplate> ---
It is possible to declare-and-call an api from script,
but you must use a third-party control to do so,
or else write one yourself.
It has already been correctly pointed out that there
is no api-capability in "pure" script.
If you are willing to use a third-party control, then
one such control, called "DynaWrap", can be found on
Guenter Born's website (note: Guenter refers to it as
"DynaCall"). Here is the link to it:
http://people.freenet.de/gborn/WSHBazaar/WSHDynaCall.htm
On that page you will find a download for the control,
plus some code samples.
Note: you may find additional sample code by searching
the archives of the wsh and vbscript ng's.
Note also: DynaWrap does have its limitations. There are
certain things it can't do. For example, you can't call
api's which take typedefs as parameters, and you can't call
api's "by ordinal". But it will work for most of the
"usual suspects".
And finally, DynaWrap doesn't work entirely as advertised.
For example, it is supposed to allow for the declaration of
several api definitions in one instance of itself. I could
never get that to work (in win9x). You will need a new
instance of DynaWrap for every api, or else re-instantiate
the object for every api. Someday I'm going to learn enough
c++ to fix that...
--- </DynaWrap Boilerplate> ---
Brian Barnett wrote:
Automating Excel 2003 on IIS 6, Windows Server 2003, and VBScript in ASP page. This article (http://support.microsoft.com/kb/257757/en-us) suggests pooling a set of instances, but I don't know how to do that. Can someone provide some sample vbscript code and/or configuration that will allow this?.
I have tried simply using GetObject(,"Excel.Application") to attach to a running instance, but it never attaches any of the running instances that are available. I get this error:
Error - Number:429 Source:Microsoft VBScript runtime error Description:ActiveX component can't create object
Even with only this simple code, I still get the error every time the ASP page is requested:
Dim excelApp Set excelApp = GetObject(,"Excel.Application") If (err <> 0) Then Set excelApp = CreateObject("Excel.Application") End If excelApp.UserControl = True excelApp.Visible = True excelApp = Nothing
CreateObject just keeps creating new instances every time through the code.
Thanks,
Brian Barnett
- Follow-Ups:
- Re: "pool" a tightly controlled set of Excel instances
- From: Brian Barnett
- Re: "pool" a tightly controlled set of Excel instances
- From: Brian Barnett
- Re: "pool" a tightly controlled set of Excel instances
- Prev by Date: RGB/HEX question
- Next by Date: Re: Close almost all files/programs?
- Previous by thread: RGB/HEX question
- Next by thread: Re: "pool" a tightly controlled set of Excel instances
- Index(es):
Relevant Pages
|
|