Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with "For each" loop using .NET Interop and Excel
Can't test it here, but try
r = Excel.Selection instead of just r = Selection -- Regards Juan Pablo González "Gene Belknap" wrote in message ... Hi, When running the following code snippet using "Microsoft.Office.Interop.Excel" through VB.NET dim c as Excel.Range dim r as Excel.Range r = Selection For Each c in r '<-- Fails with "Member not found" msgbox (c.Address) Next "For Each c in r.Cells" also fails with the same error. In each case, I get the "Member not found" error. I can use a loop counter successfully. For example dim i as Integer for i = 1 to r.cells.count c = r.cells(i) msgbox (c.Address) next this code works. The "for each c in r" construct works fine with VBA. The problem is in porting VBA to .NET. Without the "for each c in r" construct, the port will be very painful and tedious. Any reason why the "for each c in r" approach does not work in .NET? Are there updates/patches that fix this? Am I missing something? Thanks, -Gene |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
problem with Linking workbooks via "copy" and "paste link" | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |