Skip to main content
1-Visitor
August 5, 2010
Question

Excel Components and Functions (Embedded & WRITEEXCEL)

  • August 5, 2010
  • 1 reply
  • 7461 views

Mainly a question for Tom Gutman, but other members can chip in if they know the answer.

There are 2 functions in the attached worksheet both supplied by Tom.

The First function uses a textbox to write data to an existiting Excel worksheet. This has a benefit over the ‘WRITEEXCEL’ function which is a new function M15 and Prime, as it allows the user to specify which cells the data can be passed too, instead of always being A1.

The second function ‘Excel storage object’ passes a range to Excel using a function. The main advantage this has over the above is that there is no external file and the Excel component stays within the Mathcad Worksheet.

I have been trying to combine positives of both functions. I want the XL function to be able to take an array as shown in function 1 and display in an embedded Excel component. At the present it doesn't work quite the way I would like.

There is a description of each of the functions within the worksheet.

I think the problem is in the VB code of the embedded Excel component, but cannot seem to solve it.

Mike

1 reply

1-Visitor
August 6, 2010

Neither of your functions work on my system. The first fails when it is unable to open the (rquired existing) XL file. Besides the file not existing, there may be a problem as my version of XL doe not support the XLSX format.

The second fails, probably because the embedded XL file is a version not supported by my XL. The code looks OK. But the examples have an inconsistency between the shape of the specified XL region and the provided data. That may be your problem.

You could also adapt the code from the first one using an embedded XL object. You would remove the code to obtain the workbook from the name and use the embedded object for WB.

1-Visitor
August 6, 2010

Tom Gutman wrote:

Neither of your functions work on my system. The first fails when it is unable to open the (rquired existing) XL file. Besides the file not existing, there may be a problem as my version of XL doe not support the XLSX format.

The second fails, probably because the embedded XL file is a version not supported by my XL. The code looks OK. But the examples have an inconsistency between the shape of the specified XL region and the provided data. That may be your problem.

You could also adapt the code from the first one using an embedded XL object. You would remove the code to obtain the workbook from the name and use the embedded object for WB.

Tom,

I have attached your original sheets which where created and saved in M11 format. The Excel file can simple be created onto your desktop, as I'm sure you know.

See if these work

Mike

1-Visitor
August 7, 2010

The first file works fine on my system, under MC14. No problem. But the shapes of the regions and the data match.

The second file just uses non-existent functions, with no definitions. I don't have (and will probably never have) MC15.