Pass array of worksheets to ActiveX DLL (VB6)
On Thu, 17 Jun 2004 20:57:43 +1000, Hank Scorpio
wrote:
That's not the problem. As I mentioned later in the original post, I
have no problems passing individual workbook objects, worksheet
objects, Word documents or any other single objects from an Office
application to the library, regardless of which version of Office I'm
passing them from. The problem only occurs when I'm attempting to pass
an ARRAY of objects, specifically (in this case) worksheets.
I did realise that. It is still quite likely that array arguments are
set up differently from scalar arguments.
You can still use early binding within the Sub:
Dim MySheet As Excel.Worksheet
Set MySheet = TargetWorksheets(n)
...
Set MySheet = Nothing
This is still dealing with only a single sheet at a time, though, and
that's something that I have no problem with.
I was presuming that you were processing the array one element at a
time:
Function TestMethodDLL(... TargetWorksheets() As Object)...
Dim MySheet As Excel.Worksheet
For n = LBound(TargetWorksheets) To UBound(TargetWorksheets)
Set MySheet = TargetWorksheets(n)
' Process MySheet
Set MySheet = Nothing
Next
Sorry I can't be more helpful.
Gale.
|