[API: VBA] SetRealValue
Hi all,
I'm still learning how to use API for Mathcad and I have a few questions about this function, SetRealValue.
1) why doesn't the code below work? I mean there are obviously no error, but it doesn't do what I want. In the selected worksheet has x:=2, I was trying to get this x:=2 to be x:=3m. This code below doesn't change anything in this sheet.
Sub test01()
Dim WS As Ptc_MathcadPrime_Automation.Worksheet
Dim App As Ptc_MathcadPrime_Automation.Application
Dim FileName
Set App = New Ptc_MathcadPrime_Automation.Application
FileName = Application.GetOpenFilename(MultiSelect:=False)
Set WS = App.Open(FileName)
Call WS.SetRealValue(x, 3, "m")
End Sub
2), why are there so many functions with the same name reappear in a few different classes? are they doing the same thing? If not, what are the differences? For examples, this SetRealValue occurs in three differences classes: IMathcadPrimeWorksheet, IMathcadPrimeWorksheet2, and Worksheet.
3) The input format for this function is variable name as string, value as double, and unit as string. What if I want to assign string as the value, can I still use this function as just assign string? or there are other functions for that?
Add 4). What happens if I have a variable defined multiple times throughout the sheet? Let say I have x:=.... in page 1 and x:=... in page2 and x:=... in page10. Which one of these will be changed? Is there a way to specify which of these x:= I want to change?
For example:
Page1
x:= 1
y:= x+1 = 2
Page2
x:= 2
y:= x+1 = 3
Page10
x:= 5
y:= x+1 = 6
which of these xs will be affected by this SetRealValue?
Thank you very much!
