LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Cvi Excel Page

Hello,
I'm using CVI Labwindows 8.0.1 with the activeX Microsoft Excel 11.0 Object Library. Unfortunately this library is not very sufficiant, so I had to add code fragments from other libraries found on different NI support pages to have e.g. SetCellRangeAttribute possibilities.
But now I'm looking for a possibility to set the page setup to DIN A4 landscape, with header and footer as also to set the zoom of the active Excel window to 60%.
As I haven't found a solution, I have create a macro in Excel. This macro should be available in all Excel workbooks, therefore I have  to have written it in the Personal.xls. If I open (by hand Excel), the Personal.xls will be (hidden) opened, thus Excel knows the macro. But if I use my CVI test bench to start Excel (Excel_ActiveApp() or if not yet active Excel_NewApp()) ,  Personal.xls will not be opened additionally, thus the macro is not known. As different users will use my program, the location of the personal.xls file will differ too. A dilemma.
 
Thus some questions result:
- How can I use via activeX a page setup facility (orientation/footer/header...)
- How can I use via activeX a zoom factor for the active Excel window
- How can I start Excel from CVI, that it opens the Personal.xls (to use general macro)
- Does exist an easy way to use VBA commands in CVI to control Excel. (It seems that their is a relationship between both?)
 
And at last I have the problem, that CVI writes into the related Excel sheet, but I could not see the results during the measurement in the Excel sheet, as Excel doesn't move the visible range of the Excel sheet. It still shows the same rows of the sheet, even if CVI writes into cells which a far outside the scope of the visible rows. Any hint for manage that (from Excel or CVI)?
 
Thanks in advanced.
0 Kudos
Message 1 of 3
(3,920 Views)

Hello AndyMike,
did you try the “exceldem2000” example from CVI Example Library?
This example shows how to use ActiveX events from an Excel ActiveX Automation server. Using this example you should be able to use macro in excel.
In my opinion you could also creating an AciveX Control  using VBA, that can be called from a program running in CVI
I have a description for diadem. Please analyse this document and try to adapt it for using in CVI.

http://digital.ni.com/public.nsf/allkb/AAD219DFFBDDEE9286256CC600725295?OpenDocument

I hope this helps!

Regards,
AmirG

0 Kudos
Message 2 of 3
(3,890 Views)
Hello,
 
thanks for reply. I will have a look in the Diadem example too,
 
I have alread try the exceldem2000. This example I used to run a macro and it works, if the macro is already available in the Excel workbook. But as I open Excel via CVI, the default workbook "Personal.xls" (similar to normal.dot in MS Word) will not be opened automatically, so that the macro is not available. Only if I first open Excel "by hand" and CVI opens only a new workbook(s), the macro facility works correctly.
 
- So how could I inform CVI to open also as hidden workbook the "Personal.xls"?
- Does anybody know an example how I can use the Excel page setup facility and the zoom window (e.g. 60%) via activeX ?
- Does it exists a trick how I get Excel to move the displayed row according to every new row entry from CVI, so that the user can follow each new measurement result entry on the screen from Excel?  (I have to use only a small CVI GUI (.uir) for other reasons) 
0 Kudos
Message 3 of 3
(3,886 Views)