Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default assign result of ExecuteExcel4Macro to an array

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default assign result of ExecuteExcel4Macro to an array

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
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


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default assign result of ExecuteExcel4Macro to an array

i use:
Sub ff()
With ActiveWorkbook
.Names.Add "tmp", "=Documents(3)"
v = [tmp]
.Names("tmp").Delete
End With
End Sub

keepITcool

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


"Peter T" wrote:

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


.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default assign result of ExecuteExcel4Macro to an array

AhHa, thanks

Seems already elegant to me <g

Peter


-----Original Message-----
i use:
Sub ff()
With ActiveWorkbook
.Names.Add "tmp", "=Documents(3)"
v = [tmp]
.Names("tmp").Delete
End With
End Sub

keepITcool

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


"Peter T" wrote:

Hi KeepItCool

<snip


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default assign result of ExecuteExcel4Macro to an array

but it should be ..nah MUST be .. doable with

evaluate() and some string manipulation involving {}...
I'm sure!

problem is with name objects that some remnants
(hidden namespace) stay in memory...
and may lead to problems.


keepITcool

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


"Peter T" wrote:

AhHa, thanks

Seems already elegant to me <g

Peter


-----Original Message-----
i use:
Sub ff()
With ActiveWorkbook
.Names.Add "tmp", "=Documents(3)"
v = [tmp]
.Names("tmp").Delete
End With
End Sub

keepITcool

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


"Peter T" wrote:

Hi KeepItCool

<snip


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default assign result of ExecuteExcel4Macro to an array

KeepITcool,

but it should be ..nah MUST be .. doable with

evaluate() and some string manipulation involving {}...
I'm sure!


Hope you're right, I'm not so sure but I'll be watching.

problem is with name objects that some remnants
(hidden namespace) stay in memory...
and may lead to problems.


I trust this only applies to a name that "refersto" an XLM,
I add/delete normal names all the time.

According to Laurent Long
http://www.cpearson.com/excel/hidden.htm
the "hidden namespace" is at application level so I assume
this is not related to a "normal" workbook level name, at
least I hope not!

Regards,
Peter


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign Values to array Jeff Excel Discussion (Misc queries) 14 July 15th 08 06:06 PM
how do I assign a symbol to the result of a part of a nested IF s. Lee Mitchell Excel Worksheet Functions 1 March 30th 05 05:32 PM
How do I assign values to an array? Skyway[_2_] Excel Programming 14 February 29th 04 01:22 AM
Possible to assign an array to a SeriesCollection Stephen Boulet Excel Programming 2 November 13th 03 06:36 PM
how to assign ranges on different sheets to an array KRCowen Excel Programming 2 July 21st 03 03:27 AM


All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"