D
David Thielen
Hi;
If you use the excel file in http://www.windwardreports.com/temp/PrevBug.zip
and then run the following code - it will not find the previous tag but
instead jumps to the first tag in the spread sheet.
This only happens if starting on a cell that has "</wr:" in it. If starting
anywhere else, it works fine.
Any idea why?
Worksheet xxWs = (Worksheet)app.NativeWorkbook.ActiveSheet;
Range xxSelOn = (Range)xxWs.UsedRange.Cells[11, 1];
// get the row on A:N -> selOn:N
Range xxxSearchRange = xxWs.get_Range(xxWs.UsedRange.Cells[xxSelOn.Row,
1], xxSelOn);
// now get the block from A:1 -> "UsedColumns.Count:row-1"
Range xxxFullRows = xxWs.get_Range(xxWs.UsedRange.Cells[1, 1],
xxWs.UsedRange.Cells[xxSelOn.Row - 1, xxWs.UsedRange.Columns.Count]);
xxxSearchRange = app.NativeApplication.Union(xxxSearchRange,
xxxFullRows, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);
Range xxxStartAfter = (Range)xxWs.UsedRange.Cells[1, 1];
Range xxxRtn = xxxSearchRange.Find("<wr:", xxxStartAfter,
XlFindLookIn.xlValues, XlLookAt.xlPart, XlSearchOrder.xlByRows,
forward ? XlSearchDirection.xlNext : XlSearchDirection.xlPrevious,
false, false,
Type.Missing);
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
If you use the excel file in http://www.windwardreports.com/temp/PrevBug.zip
and then run the following code - it will not find the previous tag but
instead jumps to the first tag in the spread sheet.
This only happens if starting on a cell that has "</wr:" in it. If starting
anywhere else, it works fine.
Any idea why?
Worksheet xxWs = (Worksheet)app.NativeWorkbook.ActiveSheet;
Range xxSelOn = (Range)xxWs.UsedRange.Cells[11, 1];
// get the row on A:N -> selOn:N
Range xxxSearchRange = xxWs.get_Range(xxWs.UsedRange.Cells[xxSelOn.Row,
1], xxSelOn);
// now get the block from A:1 -> "UsedColumns.Count:row-1"
Range xxxFullRows = xxWs.get_Range(xxWs.UsedRange.Cells[1, 1],
xxWs.UsedRange.Cells[xxSelOn.Row - 1, xxWs.UsedRange.Columns.Count]);
xxxSearchRange = app.NativeApplication.Union(xxxSearchRange,
xxxFullRows, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);
Range xxxStartAfter = (Range)xxWs.UsedRange.Cells[1, 1];
Range xxxRtn = xxxSearchRange.Find("<wr:", xxxStartAfter,
XlFindLookIn.xlValues, XlLookAt.xlPart, XlSearchOrder.xlByRows,
forward ? XlSearchDirection.xlNext : XlSearchDirection.xlPrevious,
false, false,
Type.Missing);
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm