DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel File modifying

Solved!
Go to solution

Hi,

I created an Excel file wich I use as a template for some data analysis reports. I'd like to use DIAdem to change values in this file and to save it, but without changing the original file design.

I already tried to save as a CSV, but of course the special fonts and colors I used are not supported. A TDM doesn't fit eather.

For information, I know I could do such things directly in DIAdem Reports, but the result wasn't completly what I expected, and I want to export Excel files to allow people without DIAdem to modify the values if necessary.

I join the Excel template I want to modify with DIAdem, to make it clear.

I hope I am clear and somebody has an idea to solve this question.

Thanks for help.

0 Kudos
Message 1 of 2
(2,676 Views)
Solution
Accepted by topic author Romain.P

Hi,

If Excel is installed you can use its OLE interface to write new data to your file.

Here's a simple example:

dim oExcel,oWS
'get excel automation object and open workbook / -sheet
set oExcel = CreateObject("Excel.Application")
call oExcel.Workbooks.Open(CurrentScriptPath & "Report Template.xlsx")
set oWS = oExcel.Worksheets(1)
'change your data here using line and column index for your cells
oWS.Cells(3,3).Value = 11
'save file and close Excel
call oExcel.ActiveWorkbook.Save()
call oExcel.Quit()
set oExcel = nothing

Also have a look at this DIAdem example: DIAdem Client Operation with Excel as Server

Regards

Christian
CLA, CTA, CLED
0 Kudos
Message 2 of 2
(2,628 Views)