Communicating with Excel (VC++ 6.0 MFC)
-
Hi, i wrote an application which can communicate with excel. I have build an dialog based project with automation. The next step was including the classes from a Type Library (Excel.exe). Now i can start excel via m_pApp.CreateDispatch("Excel.Application"); and select Ranges and Fill Cells. My Question is: How to communicate with excel without starting excel.exe (in Taskmanager as an proccess). Is it possible to do this. I heard a lot of COM i always thought automation means COM. My C++ Skills are not the best. I won´t use ActiveX elements in my Project. Is there any tutorial or can anybody help me to communicate with excel without starting a excel.exe proccess. Thx in advance. Sorry for bad english. Bye
-
Hi, i wrote an application which can communicate with excel. I have build an dialog based project with automation. The next step was including the classes from a Type Library (Excel.exe). Now i can start excel via m_pApp.CreateDispatch("Excel.Application"); and select Ranges and Fill Cells. My Question is: How to communicate with excel without starting excel.exe (in Taskmanager as an proccess). Is it possible to do this. I heard a lot of COM i always thought automation means COM. My C++ Skills are not the best. I won´t use ActiveX elements in my Project. Is there any tutorial or can anybody help me to communicate with excel without starting a excel.exe proccess. Thx in advance. Sorry for bad english. Bye
Communicating with Excel.Application requires that excel be started. If your issue is that this application is visible, then you can probabaly find a visibility method in excel itself. It should be something like m_pApp->SetVisible(false), althought i'm pretty sure my syntax isnt the right one. Other than that, there is a package that is being sold that allows to manipulate excel at the file level but its not free. Can't remember the package name thought.
-
Communicating with Excel.Application requires that excel be started. If your issue is that this application is visible, then you can probabaly find a visibility method in excel itself. It should be something like m_pApp->SetVisible(false), althought i'm pretty sure my syntax isnt the right one. Other than that, there is a package that is being sold that allows to manipulate excel at the file level but its not free. Can't remember the package name thought.
Hi darkbyte, thx for reply!!! Your code is totaly correct ->SetVisible(true) If i dont use: ->SetVisible(false) Excel is hidden and not visible @ the Taskbar but i can see it in the Taskmanager as an active process. If i use: ->SetVisible(true) Excel appears in the Taskbar and is started as proccess and application in Taskmanager. My Question is: Is it possible to communicate with excel without having an running excel.exe proccess? I thought COM doesnt need an active procces to communicate. Thx darkbyte maybe anybody else can help too.
-
Hi darkbyte, thx for reply!!! Your code is totaly correct ->SetVisible(true) If i dont use: ->SetVisible(false) Excel is hidden and not visible @ the Taskbar but i can see it in the Taskmanager as an active process. If i use: ->SetVisible(true) Excel appears in the Taskbar and is started as proccess and application in Taskmanager. My Question is: Is it possible to communicate with excel without having an running excel.exe proccess? I thought COM doesnt need an active procces to communicate. Thx darkbyte maybe anybody else can help too.
Most Automation Application will be running when you create an instance of them in your application. The reason being that for most operations to be performed, excel need to be running. This makes things a little complex sometimes. Like trying to do something that pops a dialog box only when certain conditions are met. Then the excel application seems like it is stale, but its waiting for a user to click on the "OK" button of the dialog it just popped. Same applies to most members of MS Office family. So, its a definitive NO, you cannot communicate with Excel without having a running excel.exe COM Automation does require to have an active process. This of it this way: if you start your program 3 times, you will have 3 different Excel applications running, and this is a good thing. You dont want a process intensive task to prevent your 2 other programs to wait when all they do is a simple task each.