|
Genarate wrapper classes for Excel type library. Select 'MFC class from TypeLib' option while adding a class. Select 'From file' radio btn and browse for excel type library. For MsOffice 2003 & 2007 type library is in Excel.Exe itself, for older versions it may vary. see how to use the generated classes http://support.microsoft.com/kb/186122[^]
|
|
|
|
|
but problem is that it always open new file I want to read data from a excel which is already open Trioum
|
|
|
|
|
don't worry as long as there is GetActiveObject() API, u can get the running instance of excel and handle the sheets already opened in it . Have a look at http://support.microsoft.com/kb/238975 and
http://support.microsoft.com/kb/196776modified on Wednesday, March 17, 2010 10:54 AM
|
|
|
|
|
Still doing lot of r&d I am not able to get that excel object to read values of cells Trioum
|
|
|
|
|
|
I could not get the alrady worksheet object using IDispatch Trioum
|
|
|
|
|
Try this one , is very good class ( created with MFC )
|
|
|
|
|
CoInitialize(NULL);
HRESULT hr;
CLSID clsidExcelApp;
// get CLSID of Excel Application
hr = CLSIDFromProgID(L"Excel.Application", &clsidExcelApp);
IUnknown *pUnk = 0;
// get running object that has been registered with OLE.
hr = GetActiveObject(clsidExcelApp, NULL, &pUnk);
if(SUCCEEDED(hr))
{
IDispatch *pDisp = 0;
hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDisp);
//use class wizard generated excel type lib classes..
CApplication oApp(pDisp);
CWorkbooks oBooks = oApp.get_Workbooks();
CWorkbook oBook = oBooks.get_Item(COleVariant((short)1)); //First workbook
CWorksheets oSheets = oBook.get_Worksheets();
CWorksheet oSheet = oSheets.get_Item(COleVariant((short)1)); //First work sheet
oSheet.Activate();
CRange oRange = oSheet.get_Range(COleVariant(CString(L"A1")), COleVariant(CString(L"A1"))); //cell A1
COleVariant var = oRange.get_Text();
MessageBox(var.bstrVal, L"Text in cell A1");
}
doesn't work? ![D'Oh! | :doh:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_doh.gif)
|
|
|
|
|
Hi,
I want to convert CString array to managed code ot send it to C#.
For normal CString i did like this,
CString menu = "MENU";
String ^ msg = gcnew String(menu);
Globals1::gwtoolbar->Add(msg);
But now i want to send array of string.i dont know how to do for CString array.
When i gave like this it shows error
CString menu[10];
String[] ^ msg = gcnew String(menu);
How can i convert it?Anu
|
|
|
|
|
|
i want to create a mfc application which will display a html page in the dialog,
and it contains a button in the html page,when i click it, it will show a messagebox with the massage "hello world!".
how to implement it?
who knows? please help me, thank you very much!
|
|
|
|
|
Off the top of my head, I'd look at CDHtmlDialog ."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
i am new in programming and i'm facing this problem.
i have a main frame. and i have a ToolStripMenuItem in my Main Frame. For this menu item, i put a code as below: (1example)
// loadToolStripMenuItem
//
this->loadToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->fromLibraryToolStripMenuItem,
this->newToolStripMenuItem});
this->loadToolStripMenuItem->Name = L"loadToolStripMenuItem";
this->loadToolStripMenuItem->Size = System::Drawing::Size(137, 22);
this->loadToolStripMenuItem->Text = L"Load..";
// ((this is a declaration))
......
((and i put the coding somewhat like below**because i couldnt find the right code))
private: System::Void fromLibraryToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
loadfromlib.h ^ openfiledialog = gcnew loadfromlib();
openfiledialog->ShowDialog();
}
when i tried to run the system; in main frame, when i click the ToolStripMenuItem, it does oppened the child frame, but it didnt work well. when the child frame is still opened, i can also click another ToolStripMenuItem as well.
i hope somebody can understand my problem and can help me solving this problem.. please, and thanks in advance...
|
|
|
|
|
|
hi.. i want code for desinging a compiler for a new language in c..plz help ...send code to this forum...
|
|
|
|
|
pavithraram wrote: hi.. i want code for desinging a compiler for a new language in c..plz help ...send code to this forum...
This is a very dumb question.
Building a compiler usign the C language is really difficult (even if the 'new' language is simple). You should start reading books about compiler construction (for instance the famous 'dragon' book [^]) and consider using tools such flex and bison (see, for instance [^]).
Moreover, asking for the code 'for a new language' (what language?) is really silly.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Never expect a code from a forum, expect a help.
Compiler designing and development is a very complex activity, i don't think, it is good choice to ask about it.
Firstly learn about compiler.
I am sending some of the website that may help u understand the vastness of compiler design.
[^]Величие не Бога может быть недооценена.
|
|
|
|
|
You forgot to say that it was urgent
Seriously, you really believe that someone will write a full compiler for you for free ? On which planet are you living ?
|
|
|
|
|
pavithraram wrote: send code to this forum
I don't think so.Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Holy crap Wes! Now there's something we could agree on.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Rajesh R Subramanian wrote: we could agree on
Oh good! Of course I wasn't aware that we disagreed on anything... Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
|
hi. i want a double cheeseburger, hold the mayo, and a lemonade. thanks. send it to this forum.
while you're at it, get all that for everyone here on the forum. and i'd also like to order blueprints for the design of a mansion. thanks.
just a word of advice, code is not part of the design, it's implementation.
|
|
|
|
|
Me think coding the compiler is the least of your problem.
anyway, read this, it's essential reading for anyone who want to write compiler. :
Principles of Compiler Design[^]Watched code never compiles.
|
|
|
|