Re: Get all the ranges of a Excel spreadsheet
Re: Get all the ranges of a Excel spreadsheet
- Subject: Re: Get all the ranges of a Excel spreadsheet
- From: David Wignall <email@hidden>
- Date: Fri, 18 Apr 2003 22:28:41 +1200
on 18/4/2003 6:31 PM, Sam Griffith at email@hidden wrote:
>
You say it's a collection? Why not a List?
>
>
Also, why when I do something like so:
>
>
repeat with x in every item of Names
>
-- do something
>
end repeat
>
>
It doesn't it work? Tells me that Names doesn't understand "every". It
>
seems to me that the Excel collections don't behave like Lists and the
>
Collections class sure isn't documented in the AS Dictionary that I can see
>
in Script Editor...
Okey doke :) The Excel dictionary says that Name is a class and as I
understand it a class is the 'definition' of an object. Therefore all of the
Names in the workbook are objects and a group of the same objects in VBA is
known as a collection, which is why I used that word. Sloppy on my part and
I apologise but hey, I'm on holiday.
Anyway, it implies that the Names themselves aren't a list but that you can
gather the name of each Name into one:
--
tell Application "Microsoft Excel"
set txtListOfNames to {}
repeat with intCounter from 1 to (count of Names)
set txtListOfNames to txtListOfNames & Name of Name (intCounter)
end repeat
set varValuesList to {}
repeat with txtPlaceHolder in every item of txtListOfNames
if txtPlaceHolder as string = "TestName" then
set varValuesList to Value of Range (txtPlaceHolder)
end if
end repeat
varValuesList
end tell
--
-- {{42.0}, {"Albert"}, {"Victoria"}, {42.0}, {"H|sker D|"}, {42.0}}
Tested with Smile and Excel X and a named workbook range TestName, amongst
others.
>
Thanks for the help!
You're welcome. I hope that I am actually helping :)
--
Dave
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.