cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

WRITEEXCEL is corrupting Excel file

Johnruehlz
7-Bedrock

WRITEEXCEL is corrupting Excel file

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

16 REPLIES 16

What about Mathcad Prime?

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

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

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. 

hi,

 

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

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.

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.

 

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

Hi Luc,

 

The problem of writing to an Excel file is to the supported file type.  Looking for a work around now.

 

Cheers

Terry

Hi,

 

Enclosed is a MathCad worksheet that simplifies input and calculation of the circuit parameters.

Input takes in all the circuit inputs for one/each circuit into a matrix.  One matrix for cable data.  Three values epsilon, MVAbase and kVbase.

This is far less cluttered than the way you were doing it.  You only need read eight main matrices.

Calculations are done once in the program and just reused.

I have not copied the MathCad results to the spreadsheet.  Just wanted to show you a neater way to set out the Mathcad worksheet..

 

Enclosed is a slightly reworked spreadsheet I just moved a couple of columns around to keep inputs together.

The spreadsheet calculates the results itself.  They are not copied from Mathcad.

 

Cheers

TH

Thanks for the help I think the easiest route might be just to make MathCad produce the array then just copy the array into MathCad. Unfortunately now I'm expirencing errors between my co-workers. Has anyone had a problem accessing the excel file from MathCad?

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.

Thanks for the hard work! Can you explain how this works so I can use it in the future?

Also if you could. Can you transpose this into the orignal file I had? I just need the name to stay the same and also I (my boss) prefers the formatting of the original file. 

hi,

 

will help if i can.

better to now take this out of the forum as we have an answer.

terryhendicott at gmail dot com

please be a bit more specific.  

it is simple to change the name of the files.

 

"I (my boss) prefers the formatting of the original file. " 

do you mean the original excel, or original mathcad?  can you be more specific.

does he prefer the original mathcad because it uses names,  the programming in my mathcad sheet can be slightly altered for readability and can use named variables in the program for easier checking.  it just makes the program a little longer.

 

cheers

terry

hi

"Can you transpose this into the orignal file I had? I just need the name to stay the same and also I (my boss) prefers the formatting of the original file. "

 

See enclosed  

Top Tags