Bonjour,
Je viens de tomber sur un article que je trouve intéressant (taper « A brief introduction to C++ and interfacing with Excel » Andrew L. Hazel sur Google).
Dans ce document pdf, la dernière partie traite de comment utiliser Excel à partir de C++
Je place le code ici qui est censé faire apparaître une fenetre excel à l’ecran lors de l’éxécution…
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 //MicroSoft Office Objects #import \ "C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll" \ rename("DocumentProperties", "DocumentPropertiesXL") \ rename("RGB", "RBGXL") //Microsoft VBA Objects #import \ "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\vbe6ext.olb" //Excel Application Objects #import "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" \ rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL") \ rename("DocumentProperties", "DocumentPropertiesXL") \ rename("ReplaceText", "ReplaceTextXL") \ rename("CopyFile", "CopyFileXL") \ exclude("IFont", "IPicture") no_dual_interfaces int main() { Excel::_ApplicationPtr XL; //A try block is used to trap any errors in communication try { //Initialise COM interface CoInitialize(NULL); //Start the Excel Application XL.CreateInstance(L"Excel.Application"); //Make the Excel Application visible, so that we can see it! XL->Visible = true; } //If a communication error is thrown, catch it and complain catch(_com_error &error) { cout << "COM error " << endl; } }
Evidemment si je poste, c’est pcq chez moi ca marche pas => je voulais savoir
1/ si qqun pouvait tester chez lui et si ca marche chez lui, comment ca se fait ??
2/ si ca ne marche pas, comment faire pour que ca marche..
Merci d’avance
DH
Partager