R
RobcPettit
Hi Im using
Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Sheets objSheets;
Excel._Worksheet objSheet;
Excel.Range range;
Excel.Workbook excelWorkbook
=excelApp.Workbooks.Open("C:\\Documents and Settings\\Robert\\Desktop\
\Baccarat two",
0, false, 5, "", "", false, Excel.XlPlatform.xlWindows,
"",
true, false, 0, true, false, false);
excelApp.Visible = true;
try
{
objSheets = excelApp.Worksheets;
objSheet = (Excel._Worksheet)objSheets.get_Item(1);
range = objSheet.get_Range("A50", Missing.Value);
range = range.get_Resize(5, 5);
//Create an array.
double[,] saRet = new double[5, 5];
//Fill the array.
for (long iRow = 0; iRow < 5; iRow++)
{
for (long iCol = 0; iCol < 5; iCol++)
{
//Put a counter in the cell.
saRet[iRow, iCol] = iRow * iCol;
}
}
//Set the range value to the array.
range.set_Value(Missing.Value, saRet);
}
to open an excel workbook and send some data to its. Works
perfect, this array is only a test to see if it works. What Id like to
do now, is when the workbooks open, leave it open and update the data
every xmins. The data side is no problem already done this. My problem
is sending the data to an already openend workbook. I keep gettitng
0x800a03ec errors. If I go back to reopening the workbook its ok. I
cant keep doing that though. Any advice appreciated.
Regards Robert
Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Sheets objSheets;
Excel._Worksheet objSheet;
Excel.Range range;
Excel.Workbook excelWorkbook
=excelApp.Workbooks.Open("C:\\Documents and Settings\\Robert\\Desktop\
\Baccarat two",
0, false, 5, "", "", false, Excel.XlPlatform.xlWindows,
"",
true, false, 0, true, false, false);
excelApp.Visible = true;
try
{
objSheets = excelApp.Worksheets;
objSheet = (Excel._Worksheet)objSheets.get_Item(1);
range = objSheet.get_Range("A50", Missing.Value);
range = range.get_Resize(5, 5);
//Create an array.
double[,] saRet = new double[5, 5];
//Fill the array.
for (long iRow = 0; iRow < 5; iRow++)
{
for (long iCol = 0; iCol < 5; iCol++)
{
//Put a counter in the cell.
saRet[iRow, iCol] = iRow * iCol;
}
}
//Set the range value to the array.
range.set_Value(Missing.Value, saRet);
}
to open an excel workbook and send some data to its. Works
perfect, this array is only a test to see if it works. What Id like to
do now, is when the workbooks open, leave it open and update the data
every xmins. The data side is no problem already done this. My problem
is sending the data to an already openend workbook. I keep gettitng
0x800a03ec errors. If I go back to reopening the workbook its ok. I
cant keep doing that though. Any advice appreciated.
Regards Robert