View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_3_] Peter T[_3_] is offline
external usenet poster
 
Posts: 81
Default assign result of ExecuteExcel4Macro to an array

Hi KeepItCool

I'm afraid I don't have your answer, only a question.
Apart from needing to use a name object I also need to use
the worksheet, like this:

Sub Tester()
Dim r As Range, c, v()
ActiveWorkbook.Names.Add Name:="test", _
RefersToR1C1:="=DOCUMENTS(3)"
Set r = Rows(1)
r.FormulaArray = "=test"
c = r.SpecialCells(xlCellTypeFormulas, 2).Count
ReDim v(1 To c)
For i = 1 To c
v(i) = r.Cells(i)
Debug.Print v(i)
Next
End Sub

Not elegant! Do you have a method that does not require
the worksheet?

TIA
Peter

-----Original Message-----
anyone.. please?,pretty please? I need a response!

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


keepitcool wrote:

I'm stumbling along with following:
The idea is to get a list of all workbooks INCLUDING

addins.

How do I get following (or any xl4 macro command) to

return an array?


Function AllBooks() As Variant
Dim v
v = ExecuteExcel4Macro("Documents(3)")
Stop
End Function

For the moment I circumvent this by using a name

object...
but I'm sure there must be a more elegant way of doing

this.

keepITcool
amsterdam, holland


.