Click here to Skip to main content
15,889,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CD writing in VC Pin
Nilesh K.22-Sep-05 2:11
Nilesh K.22-Sep-05 2:11 
QuestionReading Excel files in VC Pin
kk.tvm22-Sep-05 0:31
kk.tvm22-Sep-05 0:31 
AnswerRe: Reading Excel files in VC Pin
*Dreamz22-Sep-05 0:34
*Dreamz22-Sep-05 0:34 
QuestionRe: Reading Excel files in VC Pin
kk.tvm22-Sep-05 0:37
kk.tvm22-Sep-05 0:37 
GeneralRe: Reading Excel files in VC Pin
*Dreamz22-Sep-05 0:42
*Dreamz22-Sep-05 0:42 
AnswerRe: Reading Excel files in VC Pin
Cedric Moonen22-Sep-05 0:45
Cedric Moonen22-Sep-05 0:45 
AnswerRe: Reading Excel files in VC Pin
Roger Allen22-Sep-05 2:17
Roger Allen22-Sep-05 2:17 
AnswerRe: Reading Excel files in VC Pin
Barm22-Sep-05 18:42
Barm22-Sep-05 18:42 
use Excel automation

CApplication app;
CRange range;
CWorkbook book;
CWorkbooks books;
CWorksheet sheet;
CWorksheets sheets;
VARIANT ret;
COleVariant covTrue((short)TRUE),covFalse((short)FALSE),covOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR);

try
{
CoInitialize(NULL);
if(!app.CreateDispatch("Excel.Application"))
{
AfxMessageBox("Cannot start Excel");
return;
}
books = app.get_Workbooks();
book = books.Open(fname,covOptional,covOptional,covOptional,covOptional
,covOptional,covOptional,covOptional,covOptional
,covOptional,covOptional,covOptional,covOptional
,covOptional,covOptional); // different for different ver of Excel
// check msdn website
sheets = book.get_Worksheets();
sheet = sheets.get_Item(COleVariant((short)1));
sprintf(cell,"%c%d",alpha[k],j); // eg A1, A2, etc
range = sheet.get_Range(COleVariant(cell),COleVariant(cell));
ret = range.get_Value2();
CString t = ret.bstrVal; // t will hold the value of the cell
books.Close();
app.Quit(); // close excel application remember to close application
}
catch(COleException *e)
{
char buf[1024];
sprintf(buf, "COleException %081x.", (long)e->m_sc);
}
catch(COleDispatchException *e)
{
char buf[1024];
sprintf(buf, "COleDispatchException %081x.", (long)e->m_wCode);
}
catch(...)
{
char buf[1024];
sprintf(buf, "General Exception");
}

hope tis helps

Thomas
QuestionVisualStudio: Copy/Paste a rectangular window Pin
Chintoo72322-Sep-05 0:18
Chintoo72322-Sep-05 0:18 
AnswerRe: VisualStudio: Copy/Paste a rectangular window Pin
*Dreamz22-Sep-05 0:28
*Dreamz22-Sep-05 0:28 
GeneralRe: VisualStudio: Copy/Paste a rectangular window Pin
toxcct22-Sep-05 0:34
toxcct22-Sep-05 0:34 
GeneralRe: VisualStudio: Copy/Paste a rectangular window Pin
*Dreamz22-Sep-05 0:38
*Dreamz22-Sep-05 0:38 
GeneralRe: VisualStudio: Copy/Paste a rectangular window Pin
toxcct22-Sep-05 1:30
toxcct22-Sep-05 1:30 
GeneralRe: VisualStudio: Copy/Paste a rectangular window Pin
Chintoo72322-Sep-05 1:50
Chintoo72322-Sep-05 1:50 
GeneralRe: VisualStudio: Copy/Paste a rectangular window Pin
*Dreamz22-Sep-05 2:04
*Dreamz22-Sep-05 2:04 
GeneralRe: VisualStudio: Copy/Paste a rectangular window Pin
Chintoo72322-Sep-05 5:25
Chintoo72322-Sep-05 5:25 
GeneralRe: VisualStudio: Copy/Paste a rectangular window Pin
*Dreamz22-Sep-05 19:15
*Dreamz22-Sep-05 19:15 
QuestionMODBUS/TCP communication Pin
Member 216100421-Sep-05 23:52
Member 216100421-Sep-05 23:52 
AnswerRe: MODBUS/TCP communication Pin
Rick York22-Sep-05 10:07
mveRick York22-Sep-05 10:07 
Questionhow to create a DLL Pin
Smith#21-Sep-05 22:36
Smith#21-Sep-05 22:36 
AnswerRe: how to create a DLL Pin
Nilesh K.21-Sep-05 23:14
Nilesh K.21-Sep-05 23:14 
AnswerRe: how to create a DLL Pin
douglasjordan26-Sep-05 14:38
douglasjordan26-Sep-05 14:38 
QuestionCListBox Customize Pin
fjlv200521-Sep-05 22:01
fjlv200521-Sep-05 22:01 
AnswerRe: CListBox Customize Pin
David Crow22-Sep-05 3:00
David Crow22-Sep-05 3:00 
GeneralRe: CListBox Customize Pin
fjlv200522-Sep-05 15:18
fjlv200522-Sep-05 15:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.