P
Paul
Hello,
I have been trying to write a program that works with Excel and have
been rather successful. However, I was writing the program under WinXP
and OfficeXP.. the program is meant to run under Win2000 and
Office2000.
My program runs fine on my computer (XP) but gives the "Member Not
Found" error on the Win2K computer.
Let me show you my code:
//the pointof the following function is to open an Excel file
//and make it visible to the user.
void CSresult::OnButtonExcel()
{
boxindex = m_result_box.GetCurSel ();
CString filestring =
myvector[indexoffound[boxindex]].filepath; filestring.Replace('*', '
');
if (boxindex!=-1 && resultvector[0]!=CString("No Matches Found") &&
filestring!=CString("UNKNOWN")) //not wrapped in actual program
{
COleVariant VOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
_Application objApp;
_Workbook objBook;
Workbooks objBooks;
objApp.CreateDispatch("Excel.Application");
objBooks = objApp.GetWorkbooks();
objApp.SetVisible(TRUE);
/*OK, the following call is what causes the error(of course, it's not
wrapped in the actual program)*/
objBooks.Open(filestring,
VOptional, VOptional, VOptional, VOptional,
VOptional, VOptional, VOptional, VOptional,
VOptional, VOptional, VOptional,
VOptional,VOptional,VOptional);
/* objApp.FindFile();
objApp.GetActiveWorkbook();
The above two lines would work but the user would have to select the
file -- not the wanted outcome
*/
AfxMessageBox ("Click OK When You Are Done With Excel File");
objBook.Close(COleVariant((short)FALSE), VOptional, VOptional);
objApp.Quit();
}
else
AfxMessageBox ("One of the following happened:\n1. There is no Excel
file associated with this entry.\n2. You have not made a
selection.\n3. Your search yielded no results.");
}
Any idea what could cause this error?
I thank you in advance,
Sincerely,
Paul.
(e-mail address removed)
I have been trying to write a program that works with Excel and have
been rather successful. However, I was writing the program under WinXP
and OfficeXP.. the program is meant to run under Win2000 and
Office2000.
My program runs fine on my computer (XP) but gives the "Member Not
Found" error on the Win2K computer.
Let me show you my code:
//the pointof the following function is to open an Excel file
//and make it visible to the user.
void CSresult::OnButtonExcel()
{
boxindex = m_result_box.GetCurSel ();
CString filestring =
myvector[indexoffound[boxindex]].filepath; filestring.Replace('*', '
');
if (boxindex!=-1 && resultvector[0]!=CString("No Matches Found") &&
filestring!=CString("UNKNOWN")) //not wrapped in actual program
{
COleVariant VOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
_Application objApp;
_Workbook objBook;
Workbooks objBooks;
objApp.CreateDispatch("Excel.Application");
objBooks = objApp.GetWorkbooks();
objApp.SetVisible(TRUE);
/*OK, the following call is what causes the error(of course, it's not
wrapped in the actual program)*/
objBooks.Open(filestring,
VOptional, VOptional, VOptional, VOptional,
VOptional, VOptional, VOptional, VOptional,
VOptional, VOptional, VOptional,
VOptional,VOptional,VOptional);
/* objApp.FindFile();
objApp.GetActiveWorkbook();
The above two lines would work but the user would have to select the
file -- not the wanted outcome
*/
AfxMessageBox ("Click OK When You Are Done With Excel File");
objBook.Close(COleVariant((short)FALSE), VOptional, VOptional);
objApp.Quit();
}
else
AfxMessageBox ("One of the following happened:\n1. There is no Excel
file associated with this entry.\n2. You have not made a
selection.\n3. Your search yielded no results.");
}
Any idea what could cause this error?
I thank you in advance,
Sincerely,
Paul.
(e-mail address removed)