Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi!
I would like to ask if it is possible or if there is any workaround to passing a file path to a variable then using this variable for the Insert > Reference feature?
For example, my file is located at "C:\sample.xmcd".
I would like to assign it to a variable that:
FilePath:="C:\sample.xmcd"
Then use this file path for Insert > Reference > Insert Reference to File in another worksheet.
This is because I have some user-defined functions defined in sample.xmcd that I would like to call in another worksheet.
If this is not possible, is there any other way to reference user-defined functions?
Please note that hiding the functions in the worksheet is not an option. So is defining those user-defined functions in the same worksheet.
Thanks and best regards!
Solved! Go to Solution.
Can you suggest any workaround to make this possible?
This has come up before, and there is no solution. What you want to do is desirable, and has been requested many times, but it is just one of many desirable features that have been thrown to the side in the ideological quest for Mathcad Prime.
I assume you want to use this in mathcad 15 (or less), rather than Prime.
The purpose of the 'insert reference' functionality is that you can have definitions (of variables and functions) in another 'reference' worksheet for use in a calling worksheet. So it is already possible to use "user-defined functions defined in sample.xmcd that I would like to call in another worksheet".
You can point to the reference file either relative (to the calling woksheet's location) or absolute (as in "C:\sample.xmcd").
However the feature of pointing to the reference worksheet as you describe using a variable's value is not standard, it may be possible via a scriptable component, but I'm no expert an that subject.
But, what is wrong with just inserting the reference in the worksheet where you want to use it...
Or is it that, on the basis of certain decisions or outcome, you want to choose between e.g. sample1.xmcd and sample2.xmcd?
Success!
Luc
it may be possible via a scriptable component
Unfortunately, no.
Richard Jackson wrote:
it may be possible via a scriptable component
Unfortunately, no.
I see. If that's the case, at least I'm able to eliminate one way that would not work.
Can you suggest any workaround to make this possible?
Can you suggest any workaround to make this possible?
This has come up before, and there is no solution. What you want to do is desirable, and has been requested many times, but it is just one of many desirable features that have been thrown to the side in the ideological quest for Mathcad Prime.
I assume you want to use this in mathcad 15 (or less), rather than Prime.
Yes, I am using Mathcad 15.
But, what is wrong with just inserting the reference in the worksheet where you want to use it...
Or is it that, on the basis of certain decisions or outcome, you want to choose between e.g. sample1.xmcd and sample2.xmcd?
Yes, I want to be able to select the Mathcad file from which I can use the reference from.
Hi,
I have had the same requirement and the only work around that I see is to insert the reference to all files and then using a series of logical statements define which variables from those files go forward to be used in subsequent calculations. For instance I have 2 external worksheets which define 2 options for a structural part. In the 2 external worksheets I calculate the properties of these parts, and have, as a simple example allowable stress of one option as 420 MPa and the other 360 MPa. If I give those stresses in the external worksheets different variable names, eg "as.1" and "as.2", then in my main worksheet I can select which of these to use in the subsequent calculations - "as:=if(option=1,as.1,as.2)". As long as your following calculations use the variable "as" then this can work for as many external references as you want (as.1 through as.n). Of course if your external worksheets bring in a large number of variables (as mine do) then this can be quite laborious and runs the risk of missing one or other variable.
Blessings
Frank