Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hello all,
I can get Mathcad Prime to create an excel file and write output to "Sheet1" "Sheet2" or "Sheet3" by using the WRITEEXCEL function, i.e:
write:=WRITEEXCEL(out.xlsx,MatrixA,1,1,"Sheet1!A1")
write:=WRITEEXCEL(out.xlsx,MatrixB,1,1,"Sheet2!A1")
write:=WRITEEXCEL(out.xlsx,MatrixC,1,1,"Sheet3!A1")
But if I create a custom sheet name such as "output!A1" or even "Sheet4!A1" it does not work unless I first open the excel file and create a sheet with that name, afterwards I can then run the function in mathcad and it will write output to that custom named sheet. This is not an ideal solution however! Is this a know limitiation of the WRITEEXCEL() function and is there some work-around so that I dont have to go and manually create sheets in the excel file?
I don't know for sure, but I expect it's a limitation of the WRITEEXCEL function. It attempts to write to whatever location you specify, but if that location does not exist it does not attempt to create it, it just fails.
Checked how the function works in Mathcad 15 now, there the error message actually states "Sheet does not exist." if you try to write to a sheet with custom name.
I guess I will have to write multiple Excel files rather than using more sheets...
Thanks anyway!