Click here to Skip to main content
16,013,082 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CreateProcess Method Pin
Subramaniam s.V.16-Mar-06 17:35
Subramaniam s.V.16-Mar-06 17:35 
GeneralRe: CreateProcess Method Pin
Subramaniam s.V.16-Mar-06 17:48
Subramaniam s.V.16-Mar-06 17:48 
Questionfaster method of bitmap reading Pin
_tasleem16-Mar-06 1:22
_tasleem16-Mar-06 1:22 
AnswerRe: faster method of bitmap reading Pin
Remco Hoogenboezem16-Mar-06 4:03
Remco Hoogenboezem16-Mar-06 4:03 
QuestionDisable the close button Pin
Aryan S16-Mar-06 0:59
Aryan S16-Mar-06 0:59 
AnswerRe: Disable the close button Pin
Nibu babu thomas16-Mar-06 1:22
Nibu babu thomas16-Mar-06 1:22 
AnswerRe: Disable the close button Pin
Karim Mribti16-Mar-06 1:26
Karim Mribti16-Mar-06 1:26 
QuestionExcel Automation in vc++ Pin
ledallam16-Mar-06 0:54
ledallam16-Mar-06 0:54 
Hi

I am working with excel automation. I need to write an excel file from VC++. The format of the excel file should be

Events Table
Date&Time,Source,Cause,Description,Fault - 3rd row
Mar 13 2006 12:25:05.000078,HMI,H-0001,Startup,N
Mar 13 2006 12:25:05.000187,HMI,H-0005,Caution,Y
ect...
Footer

I used excel automation as shown below.
CoInitialize(NULL);
try
{
Excel::_ApplicationPtr excel;
// Initialize Excel and make sure it's initialized
HRESULT hr = excel.CreateInstance(L"Excel.Application");

Excel::_WorkbookPtr workbook = excel->Workbooks->Add(static_cast<long> (Excel::xlWorksheet));
Excel::_WorksheetPtr worksheet = excel->ActiveSheet;

worksheet->Range["A1"]->Value = "Header1";
worksheet->Range["A2"]->Value = "Header2";

worksheet->SaveAs("c:\\test1.xls"); // Save it
workbook->Close(); // Close the workbook
excel->Quit(); // Quit excel
}
catch(_com_error &ce)
{
AfxMessageBox("Error");
}
CoUninitialize();

Now the problem is, since I don't have the number of cells varry , I want to run a ForLoop where I can input the values in the Range function as shown here.....worksheet->Range["A1"]->Value = "Header1";

I am facing some problems when I try to give the values here as
char* str = new char(3);
str = "B3";
worksheet->Range[str]->Value = "Header1";

Can anyone please help me with some sample code for doing this?

Thanks
Madhavi..
AnswerRe: Excel Automation in vc++ Pin
Waldermort16-Mar-06 2:27
Waldermort16-Mar-06 2:27 
QuestionQuestion ... Pin
HakunaMatada15-Mar-06 23:27
HakunaMatada15-Mar-06 23:27 
AnswerRe: Question ... Pin
toxcct15-Mar-06 23:36
toxcct15-Mar-06 23:36 
GeneralRe: Question ... Pin
HakunaMatada15-Mar-06 23:59
HakunaMatada15-Mar-06 23:59 
GeneralRe: Question ... Pin
Eytukan16-Mar-06 1:50
Eytukan16-Mar-06 1:50 
AnswerRe: Question ... Pin
Nibu babu thomas15-Mar-06 23:37
Nibu babu thomas15-Mar-06 23:37 
GeneralRe: Question ... Pin
HakunaMatada16-Mar-06 0:08
HakunaMatada16-Mar-06 0:08 
AnswerRe: Question ... Pin
Naveen15-Mar-06 23:39
Naveen15-Mar-06 23:39 
GeneralRe: Question ... Pin
HakunaMatada16-Mar-06 0:09
HakunaMatada16-Mar-06 0:09 
Questionadding controls in onpaint Pin
Tarek Jabri15-Mar-06 23:03
Tarek Jabri15-Mar-06 23:03 
AnswerRe: adding controls in onpaint Pin
Cedric Moonen15-Mar-06 23:09
Cedric Moonen15-Mar-06 23:09 
AnswerRe: adding controls in onpaint Pin
Hamid_RT15-Mar-06 23:19
Hamid_RT15-Mar-06 23:19 
GeneralRe: adding controls in onpaint Pin
Tarek Jabri15-Mar-06 23:38
Tarek Jabri15-Mar-06 23:38 
GeneralRe: adding controls in onpaint Pin
toxcct15-Mar-06 23:58
toxcct15-Mar-06 23:58 
GeneralRe: adding controls in onpaint Pin
Hamid_RT16-Mar-06 0:02
Hamid_RT16-Mar-06 0:02 
AnswerRe: adding controls in onpaint Pin
Maximilien16-Mar-06 3:01
Maximilien16-Mar-06 3:01 
QuestionWhy font size is specified as 8, 10, 12, 14... Pin
Nishad S15-Mar-06 22:38
Nishad S15-Mar-06 22:38 

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.