Me too now!
Really pleased to get this working. Many thanks for all your help Dan. I would never in a million years of cracked this. Much appreciated.
Steve.
:-)
I'm really sorry Dan, but I can't get that to work. jsRangeArray is still null or not an object. Perhaps I'm not using it correctly - could you throw up your code please?
Be nice to be able to edit my posts too.
If I could i would have taken out the id = 1; line in the code.
:-)
The excel sheet is simple - just four arbitrary values (1,2,3,4) in A1:B2 and a defined name (MyRange) for that range. Nothing else.
Ok Thanks.
<script type="text/javascript">
var Worksheet;
var Excel;
Worksheet = "C:\\test.xls";
Excel = new ActiveXObject("Excel.Application");
Excel.Visible = false;
var Excel_file = Excel.Workbooks.Open(Worksheet);
id = 1;
var blah =...
The debugger (Microsoft Script Debugger) returns a blank line for blah after executing
var blah = foo.ActiveSheet.Range('MyRangeName');
Trying alert(blah); returns
[object]
in the alert box so something is being assigned I assume.
Oh and I discovered that blah.length is undefined in
var blah = foo.ActiveSheet.Range('MyRangeName');
for (var loop=0; loop<blah.length; loop++) {
alert(blah[loop].Value);
}
when it comes to iterating through the loop. The code just falls through the loop without doing the alert.
If I...
Thanks again Dan.
That was exactly the approach I tried before posting in this forum - it failed for me with the debugger telling me on the alert line that
blah[...].Value is null or not an object
Now, I know that my test Excel sheet has a value in each of my tiny 2x2 testing range and can...
Thank you BillyRayPreachersSon.
I appreciate that I can use .ActiveSheet.Range('MyRangeName') but not how I can get at the values contained in those cells?
How would .ActiveSheet.Range('MyRangeName').Value know which value to return from the many values contained in a range?
Hello, I'm fairly new to Javascript and excel and have struggled with this for days now. No amount of Googling has revealed the answer to me.
How do I access the values in a named range in Excel using Javascript?
I can see how to access a single value in a known location e.g.
var1 =...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.