Skip to main content
1-Visitor
October 14, 2017
Solved

WRITEEXCEL is corrupting Excel file

  • October 14, 2017
  • 4 replies
  • 6358 views

Hi all! I'm currently using MathCad 15 and I can't seem to get the seem together the Excel function to work correctly. It keeps writing to excel and making the file corrupt and messing with the formating, making it impossible to write all the arrays to Excel is there something I'm doing wrong?

Best answer by terryhendicott

Hi,

 

Final pair.  Excel and MathCad.

 

To stop the formatting from getting changed and to allow auditing of both MathCad and Excel.

 

Workaround is in the Excel file create a "MathCad Export" worksheet tab. No formats on this worksheet.

On the actual worksheet for the job just set cells equal to corresponding cells on the MathCad Export sheet.

4 replies

24-Ruby IV
October 14, 2017

What about Mathcad Prime?

1-Visitor
October 15, 2017

I'm unable to use MathCad prime because our whole company uses 14/15

21-Topaz II
October 16, 2017

hi,

 

sometimes it is better to stick to the one thing.  the calculations you are trying to do can be done entirely in excel.

entry is only required in yellow cells.  calculation cells can be simply copied/pasted down as required.

 

to do this you need to change the 4/0 designation in text to a 4.0 designation in number format.

 

On you mathcad sheet i cannot find the subscript(i) function so this may be your problem

Cheers

Terry

1-Visitor
October 16, 2017

Subscript(i) function is found in one of the tabs. I agree that having Excel do the work would be easier, but if we get an audit it is way easier to show our findings through MathCad then Excel. 

21-Topaz II
October 16, 2017

hi,

 

sorry mistake in last file the voltage column also needs to be input so should be yellow input cells

21-Topaz II
October 16, 2017

Hi,

 

You are doing nothing wrong.  Have been messing with this today.  Excel can save files in 2003 "xls" and no year designation "xlsx"  MathCad 15 is designed to work with 2007 "xlsx" files acciording to help.  Ten years of changes in Excel file standards has not been kept up with by PTC and it is unlikely they will.

 

You can in Excel name ranges like "Cables" and "Circuit1" etc.

'

On Excel to MathCad

Excel 2003 "xls" MathCad can read and when you input into MathCad using Insert|Data|FileInput choose Excel Files, browse to a file, choose an xls 2003 file with named sheets and ranges, next.  In the drop down list boxes for "worksheet" and "named ranges" values are there to select matching those in the excel file.  With Excel "xlsx" files nothing appears in the these dialog boxes you must write it yourself in the text box. 

 

On Mathcad to Excel

You can cut and paste no worries.  Use WRITEEXCEL only supports 2007 "xlsx" files.  You can't use 2003 "xls". Using your example you do loose formats and do corrupt the file.  I will experiment some more but I think the problem is the "xlsx" standard has moved on beyond the 2007 era in the last ten years.  I have an old laptop running Excel 2007 so I will put it through its paces with WRITEEXCEL and its "xlsx" format to see if the versioning is the problem.

21-Topaz II
October 16, 2017

Hi,

 

Using Excel 2007 the same occurs. 

 

Mathcad to Excel with WriteExcel mashes the format and you get corruption warnings on opening the excel file.

Excel to Mathcad the worksheet list box and named ranges list box are blank with xlsx but filled with values when using xls 2003 files.

What we need is PTC to get the thing to work in Mathcad 15.

 

23-Emerald IV
October 16, 2017

Idle hope, I'm afraid.

PTC is putting all their efforts in Prime. All their efforts? Yes, except when a really important bug needs fixing.

Mathcad (15) documentation states which versions of Excell are supported.

Writing to Excell files of unsupported version is not a bug, but a lack of functionality.

 

Success!
Luc